Merge "SecurityManager: Classic Pairing Handler"
diff --git a/audio_hal_interface/a2dp_encoding.cc b/audio_hal_interface/a2dp_encoding.cc
index fc61128..1b362e5 100644
--- a/audio_hal_interface/a2dp_encoding.cc
+++ b/audio_hal_interface/a2dp_encoding.cc
@@ -82,11 +82,10 @@
       return a2dp_ack_to_bt_audio_ctrl_ack(A2DP_CTRL_ACK_INCALL_FAILURE);
     }
 
-    if (btif_a2dp_source_is_streaming()) {
-      LOG(ERROR) << __func__ << ": source is busy streaming";
-      return a2dp_ack_to_bt_audio_ctrl_ack(A2DP_CTRL_ACK_FAILURE);
+    if (btif_av_stream_started_ready()) {
+      // Already started, ACK back immediately.
+      return a2dp_ack_to_bt_audio_ctrl_ack(A2DP_CTRL_ACK_SUCCESS);
     }
-
     if (btif_av_stream_ready()) {
       /*
        * Post start event and wait for audio path to open.
@@ -102,11 +101,6 @@
       a2dp_pending_cmd_ = A2DP_CTRL_CMD_NONE;
       return a2dp_ack_to_bt_audio_ctrl_ack(A2DP_CTRL_ACK_SUCCESS);
     }
-
-    if (btif_av_stream_started_ready()) {
-      // Already started, ACK back immediately.
-      return a2dp_ack_to_bt_audio_ctrl_ack(A2DP_CTRL_ACK_SUCCESS);
-    }
     LOG(ERROR) << __func__ << ": AV stream is not ready to start";
     return a2dp_ack_to_bt_audio_ctrl_ack(A2DP_CTRL_ACK_FAILURE);
   }
@@ -137,7 +131,7 @@
 
   void StopRequest() override {
     if (btif_av_get_peer_sep() == AVDT_TSEP_SNK &&
-        !btif_a2dp_source_is_streaming()) {
+        !btif_av_stream_started_ready()) {
       return;
     }
     LOG(INFO) << __func__ << ": handling";
diff --git a/btif/Android.bp b/btif/Android.bp
index 6be1d81..8e55de6 100644
--- a/btif/Android.bp
+++ b/btif/Android.bp
@@ -24,8 +24,8 @@
     "system/bt/utils/include",
     "system/bt/include",
     "system/libhwbinder/include",
-    "system/security/keystore/include",
-    "hardware/interfaces/keymaster/4.0/support/include",
+    //"system/security/keystore/include",
+    //"hardware/interfaces/keymaster/4.0/support/include",
 ]
 
 // libbtif static library for target
@@ -73,7 +73,7 @@
         "src/btif_hf_client.cc",
         "src/btif_hh.cc",
         "src/btif_hd.cc",
-        "src/btif_keystore.cc",
+        //"src/btif_keystore.cc",
         "src/btif_mce.cc",
         "src/btif_pan.cc",
         "src/btif_profile_queue.cc",
@@ -107,12 +107,12 @@
         "libhidlbase",
         "libutils",
         "libcrypto",
-        "android.hardware.keymaster@4.0",
-        "android.hardware.keymaster@3.0",
-        "libkeymaster4support",
-        "libkeystore_aidl",
-        "libkeystore_binder",
-        "libkeystore_parcelables",
+        //"android.hardware.keymaster@4.0",
+        //"android.hardware.keymaster@3.0",
+        //"libkeymaster4support",
+        //"libkeystore_aidl",
+        //"libkeystore_binder",
+        //"libkeystore_parcelables",
     ],
     whole_static_libs: [
         "avrcp-target-service",
@@ -135,7 +135,7 @@
     include_dirs: btifCommonIncludes,
     srcs: [
         "test/btif_storage_test.cc",
-        "test/btif_keystore_test.cc"
+        //"test/btif_keystore_test.cc"
     ],
     header_libs: ["libbluetooth_headers"],
     shared_libs: [
@@ -150,13 +150,13 @@
         "libprocessgroup",
         "libutils",
         "libcrypto",
-        "android.hardware.keymaster@4.0",
-        "android.hardware.keymaster@3.0",
-        "libkeymaster4support",
-        "libkeystore_aidl",
-        "libkeystore_binder",
-        "libkeystore_parcelables",
-        "libbinder",
+        //"android.hardware.keymaster@4.0",
+        //"android.hardware.keymaster@3.0",
+        //"libkeymaster4support",
+        //"libkeystore_aidl",
+        //"libkeystore_binder",
+        //"libkeystore_parcelables",
+        //"libbinder",
     ],
     static_libs: [
         "libbt-bta",
diff --git a/btif/src/btif_av.cc b/btif/src/btif_av.cc
index 24e32ec..8ab336a 100644
--- a/btif/src/btif_av.cc
+++ b/btif/src/btif_av.cc
@@ -2861,6 +2861,27 @@
                                    BTIF_AV_START_STREAM_REQ_EVT);
 }
 
+void src_do_suspend_in_main_thread(btif_av_sm_event_t event) {
+  if (event != BTIF_AV_SUSPEND_STREAM_REQ_EVT &&
+      event != BTIF_AV_STOP_STREAM_REQ_EVT)
+    return;
+  auto src_do_stream_suspend = [](btif_av_sm_event_t event) {
+    bool is_idle = true;
+    for (auto it : btif_av_source.Peers()) {
+      const BtifAvPeer* peer = it.second;
+      if (peer->StateMachine().StateId() == BtifAvStateMachine::kStateStarted) {
+        btif_av_source_dispatch_sm_event(peer->PeerAddress(), event);
+        is_idle = false;
+      }
+    }
+    if (is_idle) {
+      btif_a2dp_on_stopped(nullptr);
+    }
+  };
+  // switch to main thread to prevent a race condition of accessing peers
+  do_in_main_thread(FROM_HERE, base::Bind(src_do_stream_suspend, event));
+}
+
 void btif_av_stream_stop(const RawAddress& peer_address) {
   LOG_INFO(LOG_TAG, "%s peer %s", __func__, peer_address.ToString().c_str());
 
@@ -2870,23 +2891,15 @@
   }
 
   // The active peer might have changed and we might be in the process
-  // of reconfiguring the stream. We need to stop the appopriate peer(s).
-  for (auto it : btif_av_source.Peers()) {
-    const BtifAvPeer* peer = it.second;
-    btif_av_source_dispatch_sm_event(peer->PeerAddress(),
-                                     BTIF_AV_STOP_STREAM_REQ_EVT);
-  }
+  // of reconfiguring the stream. We need to stop the appropriate peer(s).
+  src_do_suspend_in_main_thread(BTIF_AV_STOP_STREAM_REQ_EVT);
 }
 
 void btif_av_stream_suspend(void) {
   LOG_INFO(LOG_TAG, "%s", __func__);
   // The active peer might have changed and we might be in the process
   // of reconfiguring the stream. We need to suspend the appropriate peer(s).
-  for (auto it : btif_av_source.Peers()) {
-    const BtifAvPeer* peer = it.second;
-    btif_av_source_dispatch_sm_event(peer->PeerAddress(),
-                                     BTIF_AV_SUSPEND_STREAM_REQ_EVT);
-  }
+  src_do_suspend_in_main_thread(BTIF_AV_SUSPEND_STREAM_REQ_EVT);
 }
 
 void btif_av_stream_start_offload(void) {
diff --git a/btif/src/btif_config.cc b/btif/src/btif_config.cc
index ed24d7d..b1af0ba 100644
--- a/btif/src/btif_config.cc
+++ b/btif/src/btif_config.cc
@@ -38,7 +38,7 @@
 #include "btif_api.h"
 #include "btif_common.h"
 #include "btif_config_transcode.h"
-#include "btif_keystore.h"
+//#include "btif_keystore.h"
 #include "btif_util.h"
 #include "common/address_obfuscator.h"
 #include "osi/include/alarm.h"
@@ -58,15 +58,15 @@
 #define DISABLED "disabled"
 static const char* TIME_STRING_FORMAT = "%Y-%m-%d %H:%M:%S";
 
-constexpr int kBufferSize = 400 * 10;  // initial file is ~400B
+// constexpr int kBufferSize = 400 * 10;  // initial file is ~400B
 
-static bool use_key_attestation() {
+/*static bool use_key_attestation() {
   return getuid() == AID_BLUETOOTH && is_single_user_mode();
-}
+}*/
 
 #define BT_CONFIG_METRICS_SECTION "Metrics"
 #define BT_CONFIG_METRICS_SALT_256BIT "Salt256Bit"
-using bluetooth::BtifKeystore;
+// using bluetooth::BtifKeystore;
 using bluetooth::common::AddressObfuscator;
 
 // TODO(armansito): Find a better way than searching by a hardcoded path.
@@ -93,9 +93,10 @@
 static std::unique_ptr<config_t> btif_config_open(const char* filename, const char* checksum_filename);
 
 // Key attestation
-static std::string hash_file(const char* filename);
-static std::string read_checksum_file(const char* filename);
-static void write_checksum_file(const char* filename, const std::string& hash);
+// static std::string hash_file(const char* filename);
+// static std::string read_checksum_file(const char* filename);
+// static void write_checksum_file(const char* filename, const std::string&
+// hash);
 
 static enum ConfigSource {
   NOT_LOADED,
@@ -176,16 +177,17 @@
 static std::unique_ptr<config_t> config;
 static alarm_t* config_timer;
 
-static BtifKeystore btif_keystore(new keystore::KeystoreClientImpl);
+// static BtifKeystore btif_keystore(new keystore::KeystoreClientImpl);
 
 // Module lifecycle functions
 
 static future_t* init(void) {
   std::unique_lock<std::recursive_mutex> lock(config_lock);
 
-  if (is_factory_reset() ||
+  if (is_factory_reset()) delete_config_files();
+  /*if (is_factory_reset() ||
       (use_key_attestation() && !btif_keystore.DoesKeyExist()))
-    delete_config_files();
+    delete_config_files();*/
 
   std::string file_source;
 
@@ -264,7 +266,7 @@
 }
 
 static std::unique_ptr<config_t> btif_config_open(const char* filename, const char* checksum_filename) {
-  // START KEY ATTESTATION
+  /*// START KEY ATTESTATION
   // Get hash of current file
   std::string current_hash = hash_file(filename);
   // Get stored hash
@@ -280,7 +282,7 @@
   if (current_hash != stored_hash) {
     return nullptr;
   }
-  // END KEY ATTESTATION
+  // END KEY ATTESTATION*/
 
   std::unique_ptr<config_t> config = config_new(filename);
   if (!config) return nullptr;
@@ -514,11 +516,11 @@
   bool ret = config_save(*config, CONFIG_FILE_PATH);
   btif_config_source = RESET;
 
-  // Save encrypted hash
+  /*// Save encrypted hash
   std::string current_hash = hash_file(CONFIG_FILE_PATH);
   if (!current_hash.empty()) {
     write_checksum_file(CONFIG_FILE_CHECKSUM_PATH, current_hash);
-  }
+  }*/
 
   return ret;
 }
@@ -541,11 +543,11 @@
   std::unique_ptr<config_t> config_paired = config_new_clone(*config);
   btif_config_remove_unpaired(config_paired.get());
   config_save(*config_paired, CONFIG_FILE_PATH);
-  // Save hash
+  /*// Save hash
   std::string current_hash = hash_file(CONFIG_FILE_PATH);
   if (!current_hash.empty()) {
     write_checksum_file(CONFIG_FILE_CHECKSUM_PATH, current_hash);
-  }
+  }*/
 }
 
 static void btif_config_remove_unpaired(config_t* conf) {
@@ -637,12 +639,12 @@
 static void delete_config_files(void) {
   remove(CONFIG_FILE_PATH);
   remove(CONFIG_BACKUP_PATH);
-  remove(CONFIG_FILE_CHECKSUM_PATH);
-  remove(CONFIG_BACKUP_CHECKSUM_PATH);
+  // remove(CONFIG_FILE_CHECKSUM_PATH);
+  // remove(CONFIG_BACKUP_CHECKSUM_PATH);
   osi_property_set("persist.bluetooth.factoryreset", "false");
 }
 
-static std::string hash_file(const char* filename) {
+/*static std::string hash_file(const char* filename) {
   if (!use_key_attestation()) {
     LOG(INFO) << __func__ << ": Disabled for multi-user";
     return DISABLED;
@@ -698,4 +700,4 @@
       << __func__ << ": Failed encrypting checksum";
   CHECK(checksum_save(encrypted_checksum, checksum_filename))
       << __func__ << ": Failed to save checksum!";
-}
+}*/
diff --git a/gd/cert/gd_cert_device.py b/gd/cert/gd_cert_device.py
index b730b50..b579258 100644
--- a/gd/cert/gd_cert_device.py
+++ b/gd/cert/gd_cert_device.py
@@ -69,7 +69,7 @@
         self.hal = hal_cert_pb2_grpc.HciHalCertStub(self.grpc_channel)
         self.controller_read_only_property = cert_rootservice_pb2_grpc.ReadOnlyPropertyStub(self.grpc_channel)
         self.hci = hci_cert_pb2_grpc.AclManagerCertStub(self.grpc_channel)
-        self.l2cap = l2cap_cert_pb2_grpc.L2capModuleCertStub(self.grpc_channel)
+        self.l2cap = l2cap_cert_pb2_grpc.L2capClassicModuleCertStub(self.grpc_channel)
 
         # Event streams
         self.hal.hci_event_stream = EventStream(self.hal.FetchHciEvent)
diff --git a/gd/cert/gd_device.py b/gd/cert/gd_device.py
index 2cd49b7..17454f3 100644
--- a/gd/cert/gd_device.py
+++ b/gd/cert/gd_device.py
@@ -70,7 +70,7 @@
         self.controller_read_only_property = facade_rootservice_pb2_grpc.ReadOnlyPropertyStub(self.grpc_channel)
         self.hci = hci_facade_pb2_grpc.AclManagerFacadeStub(self.grpc_channel)
         self.hci_classic_security = hci_facade_pb2_grpc.ClassicSecurityManagerFacadeStub(self.grpc_channel)
-        self.l2cap = l2cap_facade_pb2_grpc.L2capModuleFacadeStub(self.grpc_channel)
+        self.l2cap = l2cap_facade_pb2_grpc.L2capClassicModuleFacadeStub(self.grpc_channel)
 
         # Event streams
         self.hal.hci_event_stream = EventStream(self.hal.FetchHciEvent)
diff --git a/gd/hci/hci_packets.pdl b/gd/hci/hci_packets.pdl
index c048c80..e3ee19e 100644
--- a/gd/hci/hci_packets.pdl
+++ b/gd/hci/hci_packets.pdl
@@ -2600,23 +2600,177 @@
 }
 
 packet LeSetExtendedAdvertisingRandomAddress : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_RANDOM_ADDRESS) {
-  _payload_,  // placeholder (unimplemented)
+  advertising_handle : 8,
+  advertising_random_address : Address,
+}
+
+packet LeSetExtendedAdvertisingRandomAddressComplete : CommandComplete (command_op_code = LE_SET_EXTENDED_ADVERTISING_RANDOM_ADDRESS) {
+  status : ErrorCode,
+}
+
+// The lower 4 bits of the advertising event properties
+enum LegacyAdvertisingProperties : 4 {
+  ADV_IND = 0x3,
+  ADV_DIRECT_IND_LOW = 0x5,
+  ADV_DIRECT_IND_HIGH = 0xD,
+  ADV_SCAN_IND = 0x2,
+  ADV_NONCONN_IND = 0,
+}
+
+enum PrimaryPhyType : 8 {
+  LE_1M = 0x01,
+  LE_CODED = 0x03,
+}
+
+enum SecondaryPhyType : 8 {
+  NO_PACKETS = 0x00,
+  LE_1M = 0x01,
+  LE_2M = 0x02,
+  LE_CODED = 0x03,
+}
+
+packet LeSetExtendedAdvertisingLegacyParameters : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_PARAMETERS) {
+  advertising_handle : 8,
+  advertising_event_legacy_properties : LegacyAdvertisingProperties,
+  _fixed_ = 0x1 : 1, // legacy bit set
+  _reserved_ : 11, // advertising_event_properties
+  primary_advertising_interval_min : 24, // 0x20 - 0xFFFFFF N * 0.625 ms
+  primary_advertising_interval_max : 24, // 0x20 - 0xFFFFFF N * 0.625 ms
+  primary_advertising_channel_map : 3,  // bit 0 - Channel 37, bit 1 - 38, bit 2 - 39
+  _reserved_ : 5,
+  own_address_type : OwnAddressType,
+  peer_address_type : PeerAddressType,
+  peer_address : Address,
+  advertising_filter_policy : AdvertisingFilterPolicy,
+  _reserved_ : 6,
+  advertising_tx_power : 8, // -127 to +20, 0x7F - no preference
+  primary_advertising_phy : PrimaryPhyType,
+  _reserved_ : 8, // secondary_advertising_max_skip
+  _reserved_ : 8, // secondary_advertising_phy
+  advertising_sid : 8, // SID subfield from the ADI field of the PDU
+  scan_request_notification_enable : Enable,
 }
 
 packet LeSetExtendedAdvertisingParameters : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_PARAMETERS) {
-  _payload_,  // placeholder (unimplemented)
+  advertising_handle : 8,
+  advertising_event_legacy_properties : 4,
+  _fixed_ = 0 : 1, // legacy bit cleared
+  advertising_event_properties : 3,
+  _reserved_ : 8,
+  primary_advertising_interval_min : 24, // 0x20 - 0xFFFFFF N * 0.625 ms
+  primary_advertising_interval_max : 24, // 0x20 - 0xFFFFFF N * 0.625 ms
+  primary_advertising_channel_map : 3,  // bit 0 - Channel 37, bit 1 - 38, bit 2 - 39
+  _reserved_ : 5,
+  own_address_type : OwnAddressType,
+  peer_address_type : PeerAddressType,
+  peer_address : Address,
+  advertising_filter_policy : AdvertisingFilterPolicy,
+  _reserved_ : 6,
+  advertising_tx_power : 8, // -127 to +20, 0x7F - no preference
+  primary_advertising_phy : PrimaryPhyType,
+  secondary_advertising_max_skip : 8, // 1 to 255, 0x00 - AUX_ADV_IND sent before next advertising event
+  secondary_advertising_phy : SecondaryPhyType,
+  advertising_sid : 8, // SID subfield from the ADI field of the PDU
+  scan_request_notification_enable : Enable,
+}
+
+packet LeSetExtendedAdvertisingParametersComplete : CommandComplete (command_op_code = LE_SET_EXTENDED_ADVERTISING_PARAMETERS) {
+  status : ErrorCode,
+  selected_tx_power : 8, // -127 to +20
+}
+
+enum Operation : 3 {
+  INTERMEDIATE_FRAGMENT = 0,
+  FIRST_FRAGMENT = 1,
+  LAST_FRAGMENT = 2,
+  COMPLETE_ADVERTISMENT = 3,
+  UNCHANGED_DATA = 4,
+}
+
+enum FragmentPreference : 1 {
+  CONTROLLER_MAY_FRAGMENT = 0,
+  CONTROLLER_SHOULD_NOT = 1,
 }
 
 packet LeSetExtendedAdvertisingData : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_DATA) {
-  _payload_,  // placeholder (unimplemented)
+  advertising_handle : 8,
+  operation : Operation,
+  _reserved_ : 5,
+  fragment_preference : FragmentPreference,
+  _reserved_ : 7,
+  _size_(advertising_data) : 8,
+  advertising_data : GapData[],
+}
+
+packet LeSetExtendedAdvertisingDataRaw : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_DATA) {
+  advertising_handle : 8,
+  operation : Operation,
+  _reserved_ : 5,
+  fragment_preference : FragmentPreference,
+  _reserved_ : 7,
+  _size_(advertising_data) : 8,
+  advertising_data : 8[],
+}
+
+packet LeSetExtendedAdvertisingDataComplete : CommandComplete (command_op_code = LE_SET_EXTENDED_ADVERTISING_DATA) {
+  status : ErrorCode,
 }
 
 packet LeSetExtendedAdvertisingScanResponse : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_SCAN_RESPONSE) {
-  _payload_,  // placeholder (unimplemented)
+  advertising_handle : 8,
+  operation : Operation,
+  _reserved_ : 5,
+  fragment_preference : FragmentPreference,
+  _reserved_ : 7,
+  _size_(scan_response_data) : 8,
+  scan_response_data : GapData[],
+}
+
+packet LeSetExtendedAdvertisingScanResponseRaw : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_SCAN_RESPONSE) {
+  advertising_handle : 8,
+  operation : Operation,
+  _reserved_ : 5,
+  fragment_preference : FragmentPreference,
+  _reserved_ : 7,
+  _size_(scan_response_data) : 8,
+  scan_response_data : 8[],
+}
+
+packet LeSetExtendedAdvertisingScanResponseComplete : CommandComplete (command_op_code = LE_SET_EXTENDED_ADVERTISING_SCAN_RESPONSE) {
+  status : ErrorCode,
+}
+
+packet LeSetExtendedAdvertisingEnableDisableAll : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_ENABLE) {
+  _fixed_ = 0x00 : 8, // Enable::DISABLED
+  _fixed_ = 0x00 : 8, // Disable all sets
+}
+
+struct EnabledSet {
+  advertising_handle : 8,
+  duration : 16,
+  max_extended_advertising_events : 8,
+}
+
+struct DisabledSet {
+  advertising_handle : 8,
+  _fixed_ = 0x00 : 16, // duration
+  _fixed_ = 0x00 : 8, // max_extended_advertising_events
+}
+
+packet LeSetExtendedAdvertisingDisable : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_ENABLE) {
+  _fixed_ = 0x00 : 8, // Enable::DISABLED
+  _count_(disabled_sets) : 8,
+  disabled_sets : DisabledSet[],
 }
 
 packet LeSetExtendedAdvertisingEnable : LeAdvertisingCommand (op_code = LE_SET_EXTENDED_ADVERTISING_ENABLE) {
-  _payload_,  // placeholder (unimplemented)
+  enable : Enable,
+  _count_(enabled_sets) : 8,
+  enabled_sets : EnabledSet[],
+}
+
+packet LeSetExtendedAdvertisingEnableComplete : CommandComplete (command_op_code = LE_SET_EXTENDED_ADVERTISING_ENABLE) {
+  status : ErrorCode,
 }
 
 packet LeReadMaximumAdvertisingDataLength : CommandPacket (op_code = LE_READ_MAXIMUM_ADVERTISING_DATA_LENGTH) {
@@ -2636,23 +2790,52 @@
 }
 
 packet LeRemoveAdvertisingSet : LeAdvertisingCommand (op_code = LE_REMOVE_ADVERTISING_SET) {
-  _payload_,  // placeholder (unimplemented)
+  advertising_handle : 8,
+}
+
+packet LeRemoveAdvertisingSetComplete : CommandComplete (command_op_code = LE_REMOVE_ADVERTISING_SET) {
+  status : ErrorCode,
 }
 
 packet LeClearAdvertisingSets : LeAdvertisingCommand (op_code = LE_CLEAR_ADVERTISING_SETS) {
-  _payload_,  // placeholder (unimplemented)
+}
+
+packet LeClearAdvertisingSetsComplete : CommandComplete (command_op_code = LE_CLEAR_ADVERTISING_SETS) {
+  status : ErrorCode,
 }
 
 packet LeSetPeriodicAdvertisingParam : LeAdvertisingCommand (op_code = LE_SET_PERIODIC_ADVERTISING_PARAM) {
-  _payload_,  // placeholder (unimplemented)
+  advertising_handle : 8,
+  periodic_advertising_interval_min : 16, // 0x006 to 0xFFFF (7.5 ms to 82s)
+  periodic_advertising_interval_max : 16, // 0x006 to 0xFFFF (7.5 ms to 82s)
+  _reserved_ : 6,
+  include_tx_power : 1,
+  _reserved_ : 9,
+}
+
+packet LeSetPeriodicAdvertisingParamComplete : CommandComplete (command_op_code = LE_SET_PERIODIC_ADVERTISING_PARAM) {
+  status : ErrorCode,
 }
 
 packet LeSetPeriodicAdvertisingData : LeAdvertisingCommand (op_code = LE_SET_PERIODIC_ADVERTISING_DATA) {
-  _payload_,  // placeholder (unimplemented)
+  advertising_handle : 8,
+  operation : Operation,
+  _reserved_ : 5,
+  _size_(scan_response_data) : 8,
+  scan_response_data : 8[],
+}
+
+packet LeSetPeriodicAdvertisingDataComplete : CommandComplete (command_op_code = LE_SET_PERIODIC_ADVERTISING_DATA) {
+  status : ErrorCode,
 }
 
 packet LeSetPeriodicAdvertisingEnable : LeAdvertisingCommand (op_code = LE_SET_PERIODIC_ADVERTISING_ENABLE) {
-  _payload_,  // placeholder (unimplemented)
+  advertising_handle : 8,
+  enable : Enable,
+}
+
+packet LeSetPeriodicAdvertisingEnableComplete : CommandComplete (command_op_code = LE_SET_PERIODIC_ADVERTISING_ENABLE) {
+  status : ErrorCode,
 }
 
 struct PhyScanParameters {
@@ -3427,19 +3610,6 @@
   RESERVED = 0x3,
 }
 
-enum PrimaryPhyType : 8 {
-  LE_1M = 0x01,
-  LE_CODED = 0x03,
-}
-
-enum SecondaryPhyType : 8 {
-  NO_PACKETS = 0x00,
-  LE_1M = 0x01,
-  LE_2M = 0x02,
-  LE_CODED = 0x03,
-}
-
-
 struct LeExtendedAdvertisingReport {
   connectable : 1,
   scannable : 1,
diff --git a/gd/hci/hci_packets_test.cc b/gd/hci/hci_packets_test.cc
index 6eb0d13..48a929c 100644
--- a/gd/hci/hci_packets_test.cc
+++ b/gd/hci/hci_packets_test.cc
@@ -418,5 +418,181 @@
 };
 DEFINE_AND_INSTANTIATE_LeSetExtendedScanEnableCompleteReflectionTest(le_set_extended_scan_enable_complete);
 
+std::vector<uint8_t> le_extended_create_connection = {
+    0x43, 0x20, 0x2a, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x08,
+    0x30, 0x00, 0x18, 0x00, 0x28, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x08, 0x30, 0x00, 0x18, 0x00, 0x28, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0x00, 0x00};
+DEFINE_AND_INSTANTIATE_LeExtendedCreateConnectionReflectionTest(le_extended_create_connection);
+
+TEST(HciPacketsTest, testLeExtendedCreateConnection) {
+  std::shared_ptr<std::vector<uint8_t>> packet_bytes =
+      std::make_shared<std::vector<uint8_t>>(le_extended_create_connection);
+  PacketView<kLittleEndian> packet_bytes_view(packet_bytes);
+  auto view = LeExtendedCreateConnectionView::Create(
+      LeConnectionManagementCommandView::Create(CommandPacketView::Create(packet_bytes_view)));
+  ASSERT_TRUE(view.IsValid());
+}
+
+std::vector<uint8_t> le_set_extended_advertising_random_address = {
+    0x35, 0x20, 0x07, 0x00, 0x77, 0x58, 0xeb, 0xd3, 0x1c, 0x6e,
+};
+
+TEST(HciPacketsTest, testLeSetExtendedAdvertisingRandomAddress) {
+  std::shared_ptr<std::vector<uint8_t>> packet_bytes =
+      std::make_shared<std::vector<uint8_t>>(le_set_extended_advertising_random_address);
+  PacketView<kLittleEndian> packet_bytes_view(packet_bytes);
+  auto view = LeSetExtendedAdvertisingRandomAddressView::Create(
+      LeAdvertisingCommandView::Create(CommandPacketView::Create(packet_bytes_view)));
+  ASSERT_TRUE(view.IsValid());
+  uint8_t random_address_bytes[] = {0x77, 0x58, 0xeb, 0xd3, 0x1c, 0x6e};
+  ASSERT_EQ(0, view.GetAdvertisingHandle());
+  ASSERT_EQ(Address(random_address_bytes), view.GetAdvertisingRandomAddress());
+}
+DEFINE_AND_INSTANTIATE_LeSetExtendedAdvertisingRandomAddressReflectionTest(le_set_extended_advertising_random_address);
+
+std::vector<uint8_t> le_set_extended_advertising_random_address_complete{
+    0x0e, 0x04, 0x01, 0x35, 0x20, 0x00,
+};
+DEFINE_AND_INSTANTIATE_LeSetExtendedAdvertisingRandomAddressCompleteReflectionTest(
+    le_set_extended_advertising_random_address_complete);
+
+std::vector<uint8_t> le_set_extended_advertising_data{
+    0x37, 0x20, 0x12, 0x00, 0x03, 0x01, 0x0e, 0x02, 0x01, 0x02, 0x0a,
+    0x09, 0x50, 0x69, 0x78, 0x65, 0x6c, 0x20, 0x33, 0x20, 0x58,
+};
+TEST(HciPacketsTest, testLeSetExtendedAdvertisingData) {
+  std::shared_ptr<std::vector<uint8_t>> packet_bytes =
+      std::make_shared<std::vector<uint8_t>>(le_set_extended_advertising_data);
+  PacketView<kLittleEndian> packet_bytes_view(packet_bytes);
+  auto view = LeSetExtendedAdvertisingDataRawView::Create(
+      LeAdvertisingCommandView::Create(CommandPacketView::Create(packet_bytes_view)));
+  ASSERT_TRUE(view.IsValid());
+  ASSERT_EQ(0, view.GetAdvertisingHandle());
+  ASSERT_EQ(Operation::COMPLETE_ADVERTISMENT, view.GetOperation());
+  ASSERT_EQ(FragmentPreference::CONTROLLER_SHOULD_NOT, view.GetFragmentPreference());
+  std::vector<uint8_t> advertising_data{
+      0x02, 0x01, 0x02, 0x0a, 0x09, 0x50, 0x69, 0x78, 0x65, 0x6c, 0x20, 0x33, 0x20, 0x58,
+  };
+  ASSERT_EQ(advertising_data, view.GetAdvertisingData());
+}
+
+DEFINE_AND_INSTANTIATE_LeSetExtendedAdvertisingDataRawReflectionTest(le_set_extended_advertising_data);
+
+std::vector<uint8_t> le_set_extended_advertising_data_complete{
+    0x0e, 0x04, 0x01, 0x37, 0x20, 0x00,
+};
+DEFINE_AND_INSTANTIATE_LeSetExtendedAdvertisingDataCompleteReflectionTest(le_set_extended_advertising_data_complete);
+
+std::vector<uint8_t> le_set_extended_advertising_parameters_set_0{
+    0x36, 0x20, 0x19, 0x00, 0x13, 0x00, 0x90, 0x01, 0x00, 0xc2, 0x01, 0x00,          0x07, 0x01,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x01, 0x00, 0x00 /*0x01*/, 0x01, 0x00,
+};
+TEST(HciPacketsTest, testLeSetExtendedAdvertisingParametersLegacySet0) {
+  std::shared_ptr<std::vector<uint8_t>> packet_bytes =
+      std::make_shared<std::vector<uint8_t>>(le_set_extended_advertising_parameters_set_0);
+  PacketView<kLittleEndian> packet_bytes_view(packet_bytes);
+  auto view = LeSetExtendedAdvertisingLegacyParametersView::Create(
+      LeAdvertisingCommandView::Create(CommandPacketView::Create(packet_bytes_view)));
+  ASSERT_TRUE(view.IsValid());
+  ASSERT_EQ(0, view.GetAdvertisingHandle());
+  ASSERT_EQ(400, view.GetPrimaryAdvertisingIntervalMin());
+  ASSERT_EQ(450, view.GetPrimaryAdvertisingIntervalMax());
+  ASSERT_EQ(0x7, view.GetPrimaryAdvertisingChannelMap());
+  ASSERT_EQ(OwnAddressType::RANDOM_DEVICE_ADDRESS, view.GetOwnAddressType());
+  ASSERT_EQ(PeerAddressType::PUBLIC_DEVICE_OR_IDENTITY_ADDRESS, view.GetPeerAddressType());
+  ASSERT_EQ(Address::kEmpty, view.GetPeerAddress());
+  ASSERT_EQ(AdvertisingFilterPolicy::ALL_DEVICES, view.GetAdvertisingFilterPolicy());
+  ASSERT_EQ(PrimaryPhyType::LE_1M, view.GetPrimaryAdvertisingPhy());
+  ASSERT_EQ(1, view.GetAdvertisingSid());
+  ASSERT_EQ(Enable::DISABLED, view.GetScanRequestNotificationEnable());
+}
+
+std::vector<uint8_t> le_set_extended_advertising_parameters_set_1{
+    0x36, 0x20, 0x19, 0x01, 0x13, 0x00, 0x90, 0x01, 0x00, 0xc2, 0x01, 0x00,          0x07, 0x01,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x01, 0x00, 0x00 /*0x01*/, 0x01, 0x00,
+};
+TEST(HciPacketsTest, testLeSetExtendedAdvertisingParametersSet1) {
+  std::shared_ptr<std::vector<uint8_t>> packet_bytes =
+      std::make_shared<std::vector<uint8_t>>(le_set_extended_advertising_parameters_set_1);
+  PacketView<kLittleEndian> packet_bytes_view(packet_bytes);
+  auto view = LeSetExtendedAdvertisingLegacyParametersView::Create(
+      LeAdvertisingCommandView::Create(CommandPacketView::Create(packet_bytes_view)));
+  ASSERT_TRUE(view.IsValid());
+  ASSERT_EQ(1, view.GetAdvertisingHandle());
+  ASSERT_EQ(400, view.GetPrimaryAdvertisingIntervalMin());
+  ASSERT_EQ(450, view.GetPrimaryAdvertisingIntervalMax());
+  ASSERT_EQ(0x7, view.GetPrimaryAdvertisingChannelMap());
+  ASSERT_EQ(OwnAddressType::RANDOM_DEVICE_ADDRESS, view.GetOwnAddressType());
+  ASSERT_EQ(PeerAddressType::PUBLIC_DEVICE_OR_IDENTITY_ADDRESS, view.GetPeerAddressType());
+  ASSERT_EQ(Address::kEmpty, view.GetPeerAddress());
+  ASSERT_EQ(AdvertisingFilterPolicy::ALL_DEVICES, view.GetAdvertisingFilterPolicy());
+  ASSERT_EQ(PrimaryPhyType::LE_1M, view.GetPrimaryAdvertisingPhy());
+  ASSERT_EQ(1, view.GetAdvertisingSid());
+  ASSERT_EQ(Enable::DISABLED, view.GetScanRequestNotificationEnable());
+}
+
+DEFINE_AND_INSTANTIATE_LeSetExtendedAdvertisingLegacyParametersReflectionTest(
+    le_set_extended_advertising_parameters_set_0, le_set_extended_advertising_parameters_set_1);
+
+std::vector<uint8_t> le_set_extended_advertising_parameters_complete{0x0e, 0x05, 0x01, 0x36, 0x20, 0x00, 0xf5};
+TEST(HciPacketsTest, testLeSetExtendedAdvertisingParametersComplete) {
+  std::shared_ptr<std::vector<uint8_t>> packet_bytes =
+      std::make_shared<std::vector<uint8_t>>(le_set_extended_advertising_parameters_complete);
+  PacketView<kLittleEndian> packet_bytes_view(packet_bytes);
+  auto view = LeSetExtendedAdvertisingParametersCompleteView::Create(
+      CommandCompleteView::Create(EventPacketView::Create(packet_bytes_view)));
+  ASSERT_TRUE(view.IsValid());
+  ASSERT_EQ(static_cast<uint8_t>(-11), view.GetSelectedTxPower());
+}
+
+DEFINE_AND_INSTANTIATE_LeSetExtendedAdvertisingParametersCompleteReflectionTest(
+    le_set_extended_advertising_parameters_complete);
+
+std::vector<uint8_t> le_remove_advertising_set_1{
+    0x3c,
+    0x20,
+    0x01,
+    0x01,
+};
+TEST(HciPacketsTest, testLeRemoveAdvertisingSet1) {
+  std::shared_ptr<std::vector<uint8_t>> packet_bytes =
+      std::make_shared<std::vector<uint8_t>>(le_remove_advertising_set_1);
+  PacketView<kLittleEndian> packet_bytes_view(packet_bytes);
+  auto view = LeRemoveAdvertisingSetView::Create(
+      LeAdvertisingCommandView::Create(CommandPacketView::Create(packet_bytes_view)));
+  ASSERT_TRUE(view.IsValid());
+  ASSERT_EQ(1, view.GetAdvertisingHandle());
+}
+
+DEFINE_AND_INSTANTIATE_LeRemoveAdvertisingSetReflectionTest(le_remove_advertising_set_1);
+
+std::vector<uint8_t> le_remove_advertising_set_complete{
+    0x0e, 0x04, 0x01, 0x3c, 0x20, 0x00,
+};
+DEFINE_AND_INSTANTIATE_LeRemoveAdvertisingSetCompleteReflectionTest(le_remove_advertising_set_complete);
+
+std::vector<uint8_t> le_set_extended_advertising_disable_1{
+    0x39, 0x20, 0x06, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00,
+};
+TEST(HciPacketsTest, testLeSetExtendedAdvertisingDisable1) {
+  std::shared_ptr<std::vector<uint8_t>> packet_bytes =
+      std::make_shared<std::vector<uint8_t>>(le_set_extended_advertising_disable_1);
+  PacketView<kLittleEndian> packet_bytes_view(packet_bytes);
+  auto view = LeSetExtendedAdvertisingDisableView::Create(
+      LeAdvertisingCommandView::Create(CommandPacketView::Create(packet_bytes_view)));
+  ASSERT_TRUE(view.IsValid());
+  auto disabled_set = view.GetDisabledSets();
+  ASSERT_EQ(1, disabled_set.size());
+  ASSERT_EQ(1, disabled_set[0].advertising_handle_);
+}
+
+DEFINE_AND_INSTANTIATE_LeSetExtendedAdvertisingDisableReflectionTest(le_set_extended_advertising_disable_1);
+
+std::vector<uint8_t> le_set_extended_advertising_enable_complete{
+    0x0e, 0x04, 0x01, 0x39, 0x20, 0x00,
+};
+DEFINE_AND_INSTANTIATE_LeSetExtendedAdvertisingEnableCompleteReflectionTest(
+    le_set_extended_advertising_enable_complete);
+
 }  // namespace hci
 }  // namespace bluetooth
diff --git a/gd/l2cap/Android.bp b/gd/l2cap/Android.bp
index 3d65446..0bdfbd2 100644
--- a/gd/l2cap/Android.bp
+++ b/gd/l2cap/Android.bp
@@ -2,14 +2,11 @@
     name: "BluetoothL2capSources",
     srcs: [
         "fcs.cc",
-        "classic/dynamic_channel.cc",
         "classic/dynamic_channel_manager.cc",
         "classic/dynamic_channel_service.cc",
         "classic/fixed_channel.cc",
         "classic/fixed_channel_manager.cc",
         "classic/fixed_channel_service.cc",
-        "classic/internal/dynamic_channel_allocator.cc",
-        "classic/internal/dynamic_channel_impl.cc",
         "classic/internal/dynamic_channel_service_manager_impl.cc",
         "classic/internal/fixed_channel_impl.cc",
         "classic/internal/fixed_channel_service_manager_impl.cc",
@@ -17,8 +14,13 @@
         "classic/internal/link_manager.cc",
         "classic/internal/signalling_manager.cc",
         "classic/l2cap_classic_module.cc",
+        "dynamic_channel.cc",
         "internal/basic_mode_channel_data_controller.cc",
+        "internal/data_pipeline_manager.cc",
+        "internal/dynamic_channel_allocator.cc",
+        "internal/dynamic_channel_impl.cc",
         "internal/enhanced_retransmission_mode_channel_data_controller.cc",
+        "internal/le_credit_based_channel_data_controller.cc",
         "internal/receiver.cc",
         "internal/scheduler_fifo.cc",
         "internal/sender.cc",
@@ -35,16 +37,17 @@
 filegroup {
     name: "BluetoothL2capTestSources",
     srcs: [
-        "classic/internal/dynamic_channel_allocator_test.cc",
-        "classic/internal/dynamic_channel_impl_test.cc",
         "classic/internal/dynamic_channel_service_manager_test.cc",
         "classic/internal/fixed_channel_impl_test.cc",
         "classic/internal/fixed_channel_service_manager_test.cc",
         "classic/internal/link_manager_test.cc",
         "classic/internal/signalling_manager_test.cc",
         "internal/basic_mode_channel_data_controller_test.cc",
+        "internal/dynamic_channel_allocator_test.cc",
+        "internal/dynamic_channel_impl_test.cc",
         "internal/enhanced_retransmission_mode_channel_data_controller_test.cc",
         "internal/fixed_channel_allocator_test.cc",
+        "internal/le_credit_based_channel_data_controller_test.cc",
         "internal/receiver_test.cc",
         "internal/scheduler_fifo_test.cc",
         "internal/sender_test.cc",
@@ -73,7 +76,7 @@
 filegroup {
     name: "BluetoothL2capFuzzTestSources",
     srcs: [
-        "classic/internal/dynamic_channel_allocator_fuzz_test.cc",
+        "internal/dynamic_channel_allocator_fuzz_test.cc",
         "l2cap_packet_fuzz_test.cc",
     ],
 }
diff --git a/gd/l2cap/classic/cert/api.proto b/gd/l2cap/classic/cert/api.proto
index 687686f..a80e648 100644
--- a/gd/l2cap/classic/cert/api.proto
+++ b/gd/l2cap/classic/cert/api.proto
@@ -7,6 +7,8 @@
 
 service L2capClassicModuleCert {
   rpc SendL2capPacket(L2capPacket) returns (google.protobuf.Empty) {}
+  rpc SendIFrame(IFrame) returns (SendIFrameResult) {}
+  rpc SendSFrame(SFrame) returns (SendSFrameResult) {}
 
   rpc SetupLink(SetupLinkRequest) returns (SetupLinkResponse) {}
   rpc DisconnectLink(DisconnectLinkRequest) returns (google.protobuf.Empty) {}
@@ -33,6 +35,30 @@
   bytes payload = 3;
 }
 
+message IFrame {
+  facade.BluetoothAddress remote = 1;
+  uint32 channel = 2;
+  uint32 sar = 3;
+  uint32 tx_seq = 4;
+  uint32 req_seq = 5;
+  uint32 f = 6;
+  uint32 sdu_size = 7;
+  bytes information = 8;
+}
+
+message SendIFrameResult {}
+
+message SFrame {
+  facade.BluetoothAddress remote = 1;
+  uint32 channel = 2;
+  uint32 req_seq = 3;
+  uint32 f = 4;
+  uint32 p = 5;
+  uint32 s = 6;
+}
+
+message SendSFrameResult {}
+
 message DisconnectLinkRequest {
   facade.BluetoothAddress remote = 1;
 }
diff --git a/gd/l2cap/classic/cert/cert.cc b/gd/l2cap/classic/cert/cert.cc
index 2de345c..abb3561 100644
--- a/gd/l2cap/classic/cert/cert.cc
+++ b/gd/l2cap/classic/cert/cert.cc
@@ -80,6 +80,37 @@
     return ::grpc::Status::OK;
   }
 
+  ::grpc::Status SendIFrame(::grpc::ServerContext* context, const ::bluetooth::l2cap::classic::cert::IFrame* request,
+                            ::bluetooth::l2cap::classic::cert::SendIFrameResult* response) override {
+    std::unique_ptr<RawBuilder> packet = std::make_unique<RawBuilder>();
+    auto req_string = request->information();
+    packet->AddOctets(std::vector<uint8_t>(req_string.begin(), req_string.end()));
+    std::unique_ptr<BasePacketBuilder> l2cap_builder;
+    auto f = static_cast<Final>(request->f());
+    if (request->sar() == static_cast<int>(SegmentationAndReassembly::START)) {
+      l2cap_builder = EnhancedInformationStartFrameBuilder::Create(
+          request->channel(), request->tx_seq(), f, request->req_seq(), request->sdu_size(), std::move(packet));
+    } else {
+      l2cap_builder = EnhancedInformationFrameBuilder::Create(
+          request->channel(), request->tx_seq(), f, request->req_seq(),
+          static_cast<SegmentationAndReassembly>(request->sar()), std::move(packet));
+    }
+    outgoing_packet_queue_.push(std::move(l2cap_builder));
+    send_packet_from_queue();
+    return ::grpc::Status::OK;
+  }
+
+  ::grpc::Status SendSFrame(::grpc::ServerContext* context, const ::bluetooth::l2cap::classic::cert::SFrame* request,
+                            ::bluetooth::l2cap::classic::cert::SendSFrameResult* response) override {
+    auto f = static_cast<Final>(request->f());
+    auto p = static_cast<Poll>(request->p());
+    auto s = static_cast<SupervisoryFunction>(request->s());
+    auto builder = EnhancedSupervisoryFrameBuilder::Create(request->channel(), s, p, f, request->req_seq());
+    outgoing_packet_queue_.push(std::move(builder));
+    send_packet_from_queue();
+    return ::grpc::Status::OK;
+  }
+
   ::grpc::Status SendConnectionRequest(::grpc::ServerContext* context, const cert::ConnectionRequest* request,
                                        ::google::protobuf::Empty* response) override {
     auto builder = ConnectionRequestBuilder::Create(request->signal_id(), request->psm(), request->scid());
diff --git a/gd/l2cap/classic/cert/simple_l2cap_test.py b/gd/l2cap/classic/cert/simple_l2cap_test.py
index 38d39b6..607cfb2 100644
--- a/gd/l2cap/classic/cert/simple_l2cap_test.py
+++ b/gd/l2cap/classic/cert/simple_l2cap_test.py
@@ -215,6 +215,7 @@
             log = log.data_packet
             if (log.channel == scid):
                 log.payload = basic_frame_to_enhanced_information_frame(log.payload)
+                self.cert_device.l2cap.SendSFrame(l2cap_cert_pb2.SFrame(channel=self.scid_dcid_map[scid], req_seq=1, s=0))
             data_received.append((log.channel, log.payload))
         event_handler.on(lambda log : log.HasField("data_packet"), on_data_received)
         logs = self.cert_device.l2cap.FetchL2capLog(l2cap_cert_pb2.FetchL2capLogRequest())
@@ -222,10 +223,12 @@
         assert (2, b"123") in data_received
 
         self.device_under_test.l2cap.SendDynamicChannelPacket(l2cap_facade_pb2.DynamicChannelPacket(psm=0x33, payload=b'abc'*34))
+
+        self.cert_device.l2cap.SendIFrame(l2cap_cert_pb2.IFrame(channel=self.scid_dcid_map[scid], req_seq=1, tx_seq=0, sar=0, information=b"abcd"))
+
         logs = self.cert_device.l2cap.FetchL2capLog(l2cap_cert_pb2.FetchL2capLogRequest())
         event_handler.execute(logs)
         assert (scid, b"abc"*34) in data_received
-        self.cert_device.l2cap.StopFetchingL2capLog(l2cap_cert_pb2.StopFetchingL2capLogRequest())
 
     def test_connect_and_send_data(self):
         self.device_under_test.l2cap.RegisterChannel(l2cap_facade_pb2.RegisterChannelRequest(channel=2))
diff --git a/gd/l2cap/classic/dynamic_channel_manager.h b/gd/l2cap/classic/dynamic_channel_manager.h
index 340d68d..4810270 100644
--- a/gd/l2cap/classic/dynamic_channel_manager.h
+++ b/gd/l2cap/classic/dynamic_channel_manager.h
@@ -19,9 +19,9 @@
 
 #include "hci/acl_manager.h"
 #include "hci/address.h"
-#include "l2cap/classic/dynamic_channel.h"
 #include "l2cap/classic/dynamic_channel_configuration_option.h"
 #include "l2cap/classic/dynamic_channel_service.h"
+#include "l2cap/dynamic_channel.h"
 #include "l2cap/l2cap_packets.h"
 #include "l2cap/psm.h"
 #include "l2cap/security_policy.h"
diff --git a/gd/l2cap/classic/internal/channel_configuration_state.h b/gd/l2cap/classic/internal/channel_configuration_state.h
new file mode 100644
index 0000000..b0dead5
--- /dev/null
+++ b/gd/l2cap/classic/internal/channel_configuration_state.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "l2cap/l2cap_packets.h"
+#include "l2cap/mtu.h"
+
+namespace bluetooth {
+namespace l2cap {
+namespace classic {
+namespace internal {
+
+struct ChannelConfigurationState {
+ public:
+  enum State {
+    /**
+     * for the initiator path, a request has been sent but a positive response has not yet been received, and for the
+     * acceptor path, a request with acceptable options has not yet been received.
+     */
+    WAIT_CONFIG_REQ_RSP,
+    /**
+     * the acceptor path is complete after having responded to acceptable options, but for the initiator path, a
+     * positive response on the recent request has not yet been received.
+     */
+    WAIT_CONFIG_RSP,
+    /**
+     * the initiator path is complete after having received a positive response, but for the acceptor path, a request
+     * with acceptable options has not yet been received.
+     */
+    WAIT_CONFIG_REQ,
+    /**
+     * Configuration is complete
+     */
+    CONFIGURED,
+  };
+  State state_ = State::WAIT_CONFIG_REQ_RSP;
+
+  Mtu incoming_mtu_ = kDefaultClassicMtu;
+  Mtu outgoing_mtu_ = kDefaultClassicMtu;
+  RetransmissionAndFlowControlModeOption retransmission_and_flow_control_mode_;
+  RetransmissionAndFlowControlConfigurationOption local_retransmission_and_flow_control_;
+  RetransmissionAndFlowControlConfigurationOption remote_retransmission_and_flow_control_;
+  FcsType fcs_type_ = FcsType::DEFAULT;
+};
+}  // namespace internal
+}  // namespace classic
+}  // namespace l2cap
+}  // namespace bluetooth
diff --git a/gd/l2cap/classic/internal/dynamic_channel_service_impl.h b/gd/l2cap/classic/internal/dynamic_channel_service_impl.h
index 2fcf3fc..672d24b 100644
--- a/gd/l2cap/classic/internal/dynamic_channel_service_impl.h
+++ b/gd/l2cap/classic/internal/dynamic_channel_service_impl.h
@@ -18,10 +18,10 @@
 
 #include "common/bind.h"
 
-#include "l2cap/classic/dynamic_channel.h"
 #include "l2cap/classic/dynamic_channel_configuration_option.h"
 #include "l2cap/classic/dynamic_channel_manager.h"
 #include "l2cap/classic/dynamic_channel_service.h"
+#include "l2cap/dynamic_channel.h"
 
 namespace bluetooth {
 namespace l2cap {
diff --git a/gd/l2cap/classic/internal/dynamic_channel_service_manager_impl_mock.h b/gd/l2cap/classic/internal/dynamic_channel_service_manager_impl_mock.h
index 34363f1..05d4b7f 100644
--- a/gd/l2cap/classic/internal/dynamic_channel_service_manager_impl_mock.h
+++ b/gd/l2cap/classic/internal/dynamic_channel_service_manager_impl_mock.h
@@ -15,8 +15,8 @@
  */
 #pragma once
 
-#include "l2cap/classic/internal/dynamic_channel_impl.h"
 #include "l2cap/classic/internal/dynamic_channel_service_manager_impl.h"
+#include "l2cap/internal/dynamic_channel_impl.h"
 
 #include <gmock/gmock.h>
 
diff --git a/gd/l2cap/classic/internal/fixed_channel_impl.cc b/gd/l2cap/classic/internal/fixed_channel_impl.cc
index 8ac6c94..9bfaef8 100644
--- a/gd/l2cap/classic/internal/fixed_channel_impl.cc
+++ b/gd/l2cap/classic/internal/fixed_channel_impl.cc
@@ -94,8 +94,6 @@
   link_->RefreshRefCount();
 }
 
-void FixedChannelImpl::SetSender(l2cap::internal::Sender* sender) {}
-
 }  // namespace internal
 }  // namespace classic
 }  // namespace l2cap
diff --git a/gd/l2cap/classic/internal/fixed_channel_impl.h b/gd/l2cap/classic/internal/fixed_channel_impl.h
index 6fde5c6..4c4e9f1 100644
--- a/gd/l2cap/classic/internal/fixed_channel_impl.h
+++ b/gd/l2cap/classic/internal/fixed_channel_impl.h
@@ -38,7 +38,7 @@
   virtual ~FixedChannelImpl() = default;
 
   hci::Address GetDevice() const {
-    return device_;
+    return device_.GetAddress();
   }
 
   virtual void RegisterOnCloseCallback(os::Handler* user_handler, FixedChannel::OnCloseCallback on_close_callback);
@@ -74,14 +74,13 @@
   Cid GetRemoteCid() const {
     return cid_;
   }
-  void SetSender(l2cap::internal::Sender* sender) override;
 
  private:
   // Constructor states
   // For logging purpose only
   const Cid cid_;
   // For logging purpose only
-  const hci::Address device_;
+  const hci::AddressWithType device_;
   // Needed to handle Acquire() and Release()
   Link* link_;
   os::Handler* l2cap_handler_;
diff --git a/gd/l2cap/classic/internal/fixed_channel_impl_test.cc b/gd/l2cap/classic/internal/fixed_channel_impl_test.cc
index 750473d..3a35d82 100644
--- a/gd/l2cap/classic/internal/fixed_channel_impl_test.cc
+++ b/gd/l2cap/classic/internal/fixed_channel_impl_test.cc
@@ -61,16 +61,18 @@
 TEST_F(L2capClassicFixedChannelImplTest, get_device) {
   MockParameterProvider mock_parameter_provider;
   MockLink mock_classic_link(l2cap_handler_, &mock_parameter_provider);
-  hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}};
+  hci::AddressWithType device{hci::Address{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}},
+                              hci::AddressType::PUBLIC_IDENTITY_ADDRESS};
   EXPECT_CALL(mock_classic_link, GetDevice()).WillRepeatedly(Return(device));
   FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_classic_link, l2cap_handler_);
-  EXPECT_EQ(device, fixed_channel_impl.GetDevice());
+  EXPECT_EQ(device.GetAddress(), fixed_channel_impl.GetDevice());
 }
 
 TEST_F(L2capClassicFixedChannelImplTest, close_triggers_callback) {
   MockParameterProvider mock_parameter_provider;
   MockLink mock_classic_link(l2cap_handler_, &mock_parameter_provider);
-  hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}};
+  hci::AddressWithType device{hci::Address{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}},
+                              hci::AddressType::PUBLIC_IDENTITY_ADDRESS};
   EXPECT_CALL(mock_classic_link, GetDevice()).WillRepeatedly(Return(device));
   FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_classic_link, l2cap_handler_);
 
@@ -91,7 +93,8 @@
 TEST_F(L2capClassicFixedChannelImplTest, register_callback_after_close_should_call_immediately) {
   MockParameterProvider mock_parameter_provider;
   MockLink mock_classic_link(l2cap_handler_, &mock_parameter_provider);
-  hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}};
+  hci::AddressWithType device{hci::Address{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}},
+                              hci::AddressType::PUBLIC_IDENTITY_ADDRESS};
   EXPECT_CALL(mock_classic_link, GetDevice()).WillRepeatedly(Return(device));
   FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_classic_link, l2cap_handler_);
 
@@ -112,7 +115,8 @@
 TEST_F(L2capClassicFixedChannelImplTest, close_twice_should_fail) {
   MockParameterProvider mock_parameter_provider;
   MockLink mock_classic_link(l2cap_handler_, &mock_parameter_provider);
-  hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}};
+  hci::AddressWithType device{hci::Address{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}},
+                              hci::AddressType::PUBLIC_IDENTITY_ADDRESS};
   EXPECT_CALL(mock_classic_link, GetDevice()).WillRepeatedly(Return(device));
   FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_classic_link, l2cap_handler_);
 
@@ -136,7 +140,8 @@
 TEST_F(L2capClassicFixedChannelImplTest, multiple_registeration_should_fail) {
   MockParameterProvider mock_parameter_provider;
   MockLink mock_classic_link(l2cap_handler_, &mock_parameter_provider);
-  hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}};
+  hci::AddressWithType device{hci::Address{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}},
+                              hci::AddressType::PUBLIC_IDENTITY_ADDRESS};
   EXPECT_CALL(mock_classic_link, GetDevice()).WillRepeatedly(Return(device));
   FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_classic_link, l2cap_handler_);
 
@@ -156,7 +161,8 @@
 TEST_F(L2capClassicFixedChannelImplTest, call_acquire_before_registeration_should_fail) {
   MockParameterProvider mock_parameter_provider;
   MockLink mock_classic_link(l2cap_handler_, &mock_parameter_provider);
-  hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}};
+  hci::AddressWithType device{hci::Address{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}},
+                              hci::AddressType::PUBLIC_IDENTITY_ADDRESS};
   EXPECT_CALL(mock_classic_link, GetDevice()).WillRepeatedly(Return(device));
   FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_classic_link, l2cap_handler_);
   EXPECT_DEATH(fixed_channel_impl.Acquire(), ".*Acquire.*");
@@ -165,7 +171,8 @@
 TEST_F(L2capClassicFixedChannelImplTest, call_release_before_registeration_should_fail) {
   MockParameterProvider mock_parameter_provider;
   MockLink mock_classic_link(l2cap_handler_, &mock_parameter_provider);
-  hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}};
+  hci::AddressWithType device{hci::Address{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}},
+                              hci::AddressType::PUBLIC_IDENTITY_ADDRESS};
   EXPECT_CALL(mock_classic_link, GetDevice()).WillRepeatedly(Return(device));
   FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_classic_link, l2cap_handler_);
   EXPECT_DEATH(fixed_channel_impl.Release(), ".*Release.*");
@@ -174,7 +181,8 @@
 TEST_F(L2capClassicFixedChannelImplTest, test_acquire_release_channel) {
   MockParameterProvider mock_parameter_provider;
   MockLink mock_classic_link(l2cap_handler_, &mock_parameter_provider);
-  hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}};
+  hci::AddressWithType device{hci::Address{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}},
+                              hci::AddressType::PUBLIC_IDENTITY_ADDRESS};
   EXPECT_CALL(mock_classic_link, GetDevice()).WillRepeatedly(Return(device));
   FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_classic_link, l2cap_handler_);
 
@@ -202,7 +210,8 @@
 TEST_F(L2capClassicFixedChannelImplTest, test_acquire_after_close) {
   MockParameterProvider mock_parameter_provider;
   MockLink mock_classic_link(l2cap_handler_, &mock_parameter_provider);
-  hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}};
+  hci::AddressWithType device{hci::Address{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}},
+                              hci::AddressType::PUBLIC_IDENTITY_ADDRESS};
   EXPECT_CALL(mock_classic_link, GetDevice()).WillRepeatedly(Return(device));
   FixedChannelImpl fixed_channel_impl(kSmpBrCid, &mock_classic_link, l2cap_handler_);
 
diff --git a/gd/l2cap/classic/internal/link.cc b/gd/l2cap/classic/internal/link.cc
index 7b5178f..a23f5ec 100644
--- a/gd/l2cap/classic/internal/link.cc
+++ b/gd/l2cap/classic/internal/link.cc
@@ -22,7 +22,6 @@
 #include "l2cap/classic/internal/fixed_channel_impl.h"
 #include "l2cap/classic/internal/link.h"
 #include "l2cap/internal/parameter_provider.h"
-#include "l2cap/internal/scheduler.h"
 #include "os/alarm.h"
 
 namespace bluetooth {
@@ -31,19 +30,16 @@
 namespace internal {
 
 Link::Link(os::Handler* l2cap_handler, std::unique_ptr<hci::AclConnection> acl_connection,
-           std::unique_ptr<l2cap::internal::Scheduler> scheduler,
            l2cap::internal::ParameterProvider* parameter_provider,
            DynamicChannelServiceManagerImpl* dynamic_service_manager,
            FixedChannelServiceManagerImpl* fixed_service_manager)
-    : l2cap_handler_(l2cap_handler), acl_connection_(std::move(acl_connection)), scheduler_(std::move(scheduler)),
-      receiver_(acl_connection_->GetAclQueueEnd(), l2cap_handler_, scheduler_.get()),
-      parameter_provider_(parameter_provider), dynamic_service_manager_(dynamic_service_manager),
-      fixed_service_manager_(fixed_service_manager),
-      signalling_manager_(l2cap_handler_, this, dynamic_service_manager_, &dynamic_channel_allocator_,
-                          fixed_service_manager_) {
+    : l2cap_handler_(l2cap_handler), acl_connection_(std::move(acl_connection)),
+      data_pipeline_manager_(l2cap_handler, acl_connection_->GetAclQueueEnd()), parameter_provider_(parameter_provider),
+      dynamic_service_manager_(dynamic_service_manager), fixed_service_manager_(fixed_service_manager),
+      signalling_manager_(l2cap_handler_, this, &data_pipeline_manager_, dynamic_service_manager_,
+                          &dynamic_channel_allocator_, fixed_service_manager_) {
   ASSERT(l2cap_handler_ != nullptr);
   ASSERT(acl_connection_ != nullptr);
-  ASSERT(scheduler_ != nullptr);
   ASSERT(parameter_provider_ != nullptr);
   link_idle_disconnect_alarm_.Schedule(common::BindOnce(&Link::Disconnect, common::Unretained(this)),
                                        parameter_provider_->GetClassicLinkIdleDisconnectTimeout());
@@ -60,7 +56,7 @@
 
 std::shared_ptr<FixedChannelImpl> Link::AllocateFixedChannel(Cid cid, SecurityPolicy security_policy) {
   auto channel = fixed_channel_allocator_.AllocateChannel(cid, security_policy);
-  scheduler_->AttachChannel(cid, channel);
+  data_pipeline_manager_.AttachChannel(cid, channel);
   return channel;
 }
 
@@ -90,21 +86,21 @@
   signalling_manager_.SendInformationRequest(type);
 }
 
-std::shared_ptr<DynamicChannelImpl> Link::AllocateDynamicChannel(Psm psm, Cid remote_cid,
-                                                                 SecurityPolicy security_policy) {
+std::shared_ptr<l2cap::internal::DynamicChannelImpl> Link::AllocateDynamicChannel(Psm psm, Cid remote_cid,
+                                                                                  SecurityPolicy security_policy) {
   auto channel = dynamic_channel_allocator_.AllocateChannel(psm, remote_cid, security_policy);
   if (channel != nullptr) {
-    scheduler_->AttachChannel(channel->GetCid(), channel);
+    data_pipeline_manager_.AttachChannel(channel->GetCid(), channel);
   }
   channel->local_initiated_ = false;
   return channel;
 }
 
-std::shared_ptr<DynamicChannelImpl> Link::AllocateReservedDynamicChannel(Cid reserved_cid, Psm psm, Cid remote_cid,
-                                                                         SecurityPolicy security_policy) {
+std::shared_ptr<l2cap::internal::DynamicChannelImpl> Link::AllocateReservedDynamicChannel(
+    Cid reserved_cid, Psm psm, Cid remote_cid, SecurityPolicy security_policy) {
   auto channel = dynamic_channel_allocator_.AllocateReservedChannel(reserved_cid, psm, remote_cid, security_policy);
   if (channel != nullptr) {
-    scheduler_->AttachChannel(channel->GetCid(), channel);
+    data_pipeline_manager_.AttachChannel(channel->GetCid(), channel);
   }
   channel->local_initiated_ = true;
   return channel;
@@ -120,7 +116,7 @@
   if (dynamic_channel_allocator_.FindChannelByCid(cid) == nullptr) {
     return;
   }
-  scheduler_->DetachChannel(cid);
+  data_pipeline_manager_.DetachChannel(cid);
   dynamic_channel_allocator_.FreeChannel(cid);
 }
 
diff --git a/gd/l2cap/classic/internal/link.h b/gd/l2cap/classic/internal/link.h
index 09d7eb9..8e1e0c9 100644
--- a/gd/l2cap/classic/internal/link.h
+++ b/gd/l2cap/classic/internal/link.h
@@ -21,15 +21,15 @@
 
 #include "hci/acl_manager.h"
 #include "l2cap/classic/dynamic_channel_configuration_option.h"
-#include "l2cap/classic/internal/dynamic_channel_allocator.h"
-#include "l2cap/classic/internal/dynamic_channel_impl.h"
 #include "l2cap/classic/internal/dynamic_channel_service_manager_impl.h"
 #include "l2cap/classic/internal/fixed_channel_impl.h"
 #include "l2cap/classic/internal/fixed_channel_service_manager_impl.h"
+#include "l2cap/internal/data_pipeline_manager.h"
+#include "l2cap/internal/dynamic_channel_allocator.h"
+#include "l2cap/internal/dynamic_channel_impl.h"
 #include "l2cap/internal/fixed_channel_allocator.h"
+#include "l2cap/internal/ilink.h"
 #include "l2cap/internal/parameter_provider.h"
-#include "l2cap/internal/receiver.h"
-#include "l2cap/internal/scheduler.h"
 #include "os/alarm.h"
 #include "os/handler.h"
 #include "signalling_manager.h"
@@ -39,17 +39,17 @@
 namespace classic {
 namespace internal {
 
-class Link {
+class Link : public l2cap::internal::ILink {
  public:
   Link(os::Handler* l2cap_handler, std::unique_ptr<hci::AclConnection> acl_connection,
-       std::unique_ptr<l2cap::internal::Scheduler> scheduler, l2cap::internal::ParameterProvider* parameter_provider,
+       l2cap::internal::ParameterProvider* parameter_provider,
        DynamicChannelServiceManagerImpl* dynamic_service_manager,
        FixedChannelServiceManagerImpl* fixed_service_manager);
 
   virtual ~Link() = default;
 
-  virtual hci::Address GetDevice() {
-    return acl_connection_->GetAddress();
+  virtual hci::AddressWithType GetDevice() {
+    return {acl_connection_->GetAddress(), acl_connection_->GetAddressType()};
   }
 
   struct PendingDynamicChannelConnection {
@@ -81,13 +81,13 @@
 
   virtual void SendInformationRequest(InformationRequestInfoType type);
 
-  virtual void SendDisconnectionRequest(Cid local_cid, Cid remote_cid);
+  virtual void SendDisconnectionRequest(Cid local_cid, Cid remote_cid) override;
 
-  virtual std::shared_ptr<DynamicChannelImpl> AllocateDynamicChannel(Psm psm, Cid remote_cid,
-                                                                     SecurityPolicy security_policy);
+  virtual std::shared_ptr<l2cap::internal::DynamicChannelImpl> AllocateDynamicChannel(Psm psm, Cid remote_cid,
+                                                                                      SecurityPolicy security_policy);
 
-  virtual std::shared_ptr<DynamicChannelImpl> AllocateReservedDynamicChannel(Cid reserved_cid, Psm psm, Cid remote_cid,
-                                                                             SecurityPolicy security_policy);
+  virtual std::shared_ptr<l2cap::internal::DynamicChannelImpl> AllocateReservedDynamicChannel(
+      Cid reserved_cid, Psm psm, Cid remote_cid, SecurityPolicy security_policy);
 
   virtual classic::DynamicChannelConfigurationOption GetConfigurationForInitialConfiguration(Cid cid);
 
@@ -114,10 +114,9 @@
  private:
   os::Handler* l2cap_handler_;
   l2cap::internal::FixedChannelAllocator<FixedChannelImpl, Link> fixed_channel_allocator_{this, l2cap_handler_};
-  DynamicChannelAllocator dynamic_channel_allocator_{this, l2cap_handler_};
+  l2cap::internal::DynamicChannelAllocator dynamic_channel_allocator_{this, l2cap_handler_};
   std::unique_ptr<hci::AclConnection> acl_connection_;
-  std::unique_ptr<l2cap::internal::Scheduler> scheduler_;
-  l2cap::internal::Receiver receiver_;
+  l2cap::internal::DataPipelineManager data_pipeline_manager_;
   l2cap::internal::ParameterProvider* parameter_provider_;
   DynamicChannelServiceManagerImpl* dynamic_service_manager_;
   FixedChannelServiceManagerImpl* fixed_service_manager_;
diff --git a/gd/l2cap/classic/internal/link_manager.cc b/gd/l2cap/classic/internal/link_manager.cc
index ee93fd7..96e1333 100644
--- a/gd/l2cap/classic/internal/link_manager.cc
+++ b/gd/l2cap/classic/internal/link_manager.cc
@@ -20,7 +20,6 @@
 #include "hci/address.h"
 #include "l2cap/classic/internal/link.h"
 #include "l2cap/internal/scheduler_fifo.h"
-#include "os/handler.h"
 #include "os/log.h"
 
 #include "l2cap/classic/internal/link_manager.h"
@@ -114,9 +113,7 @@
   // Register ACL disconnection callback in LinkManager so that we can clean up link resource properly
   acl_connection->RegisterDisconnectCallback(
       common::BindOnce(&LinkManager::OnDisconnect, common::Unretained(this), device), l2cap_handler_);
-  auto* link_queue_up_end = acl_connection->GetAclQueueEnd();
-  links_.try_emplace(device, l2cap_handler_, std::move(acl_connection),
-                     std::make_unique<l2cap::internal::Fifo>(link_queue_up_end, l2cap_handler_), parameter_provider_,
+  links_.try_emplace(device, l2cap_handler_, std::move(acl_connection), parameter_provider_,
                      dynamic_channel_service_manager_, fixed_channel_service_manager_);
   auto* link = GetLink(device);
   ASSERT(link != nullptr);
diff --git a/gd/l2cap/classic/internal/link_mock.h b/gd/l2cap/classic/internal/link_mock.h
index 3e0e2a6..4eb336e 100644
--- a/gd/l2cap/classic/internal/link_mock.h
+++ b/gd/l2cap/classic/internal/link_mock.h
@@ -34,16 +34,14 @@
 class MockLink : public Link {
  public:
   explicit MockLink(os::Handler* handler, l2cap::internal::ParameterProvider* parameter_provider)
-      : Link(handler, std::make_unique<MockAclConnection>(),
-             std::make_unique<l2cap::internal::testing::MockScheduler>(), parameter_provider, nullptr, nullptr){};
+      : Link(handler, std::make_unique<MockAclConnection>(), parameter_provider, nullptr, nullptr){};
   explicit MockLink(os::Handler* handler, l2cap::internal::ParameterProvider* parameter_provider,
-                    std::unique_ptr<hci::AclConnection> acl_connection,
-                    std::unique_ptr<l2cap::internal::Scheduler> scheduler)
-      : Link(handler, std::move(acl_connection), std::move(scheduler), parameter_provider, nullptr, nullptr){};
-  MOCK_METHOD(hci::Address, GetDevice, (), (override));
+                    std::unique_ptr<hci::AclConnection> acl_connection)
+      : Link(handler, std::move(acl_connection), parameter_provider, nullptr, nullptr){};
+  MOCK_METHOD(hci::AddressWithType, GetDevice, (), (override));
   MOCK_METHOD(void, OnAclDisconnected, (hci::ErrorCode status), (override));
   MOCK_METHOD(void, Disconnect, (), (override));
-  MOCK_METHOD(std::shared_ptr<DynamicChannelImpl>, AllocateDynamicChannel,
+  MOCK_METHOD(std::shared_ptr<l2cap::internal::DynamicChannelImpl>, AllocateDynamicChannel,
               (Psm psm, Cid cid, SecurityPolicy security_policy), (override));
   MOCK_METHOD(bool, IsFixedChannelAllocated, (Cid cid), (override));
   MOCK_METHOD(void, RefreshRefCount, (), (override));
diff --git a/gd/l2cap/classic/internal/signalling_manager.cc b/gd/l2cap/classic/internal/signalling_manager.cc
index 7398c17..a89d0ad 100644
--- a/gd/l2cap/classic/internal/signalling_manager.cc
+++ b/gd/l2cap/classic/internal/signalling_manager.cc
@@ -19,7 +19,9 @@
 #include <chrono>
 
 #include "common/bind.h"
+#include "l2cap/classic/internal/channel_configuration_state.h"
 #include "l2cap/classic/internal/link.h"
+#include "l2cap/internal/data_pipeline_manager.h"
 #include "l2cap/l2cap_packets.h"
 #include "os/log.h"
 #include "packet/raw_builder.h"
@@ -31,11 +33,13 @@
 static constexpr auto kTimeout = std::chrono::seconds(3);
 
 ClassicSignallingManager::ClassicSignallingManager(os::Handler* handler, Link* link,
+                                                   l2cap::internal::DataPipelineManager* data_pipeline_manager,
                                                    DynamicChannelServiceManagerImpl* dynamic_service_manager,
-                                                   DynamicChannelAllocator* channel_allocator,
+                                                   l2cap::internal::DynamicChannelAllocator* channel_allocator,
                                                    FixedChannelServiceManagerImpl* fixed_service_manager)
-    : handler_(handler), link_(link), dynamic_service_manager_(dynamic_service_manager),
-      channel_allocator_(channel_allocator), fixed_service_manager_(fixed_service_manager), alarm_(handler) {
+    : handler_(handler), link_(link), data_pipeline_manager_(data_pipeline_manager),
+      dynamic_service_manager_(dynamic_service_manager), channel_allocator_(channel_allocator),
+      fixed_service_manager_(fixed_service_manager), alarm_(handler) {
   ASSERT(handler_ != nullptr);
   ASSERT(link_ != nullptr);
   signalling_channel_ = link_->AllocateFixedChannel(kClassicSignallingCid, {});
@@ -147,23 +151,35 @@
   }
   send_connection_response(signal_id, remote_cid, new_channel->GetCid(), ConnectionResponseResult::SUCCESS,
                            ConnectionResponseStatus::NO_FURTHER_INFORMATION_AVAILABLE);
+  auto& configuration_state = channel_configuration_[new_channel->GetCid()];
   auto* service = dynamic_service_manager_->GetService(psm);
   auto initial_config = service->GetConfigOption();
+
+  auto mtu_configuration = std::make_unique<MtuConfigurationOption>();
+  mtu_configuration->mtu_ = initial_config.incoming_mtu;
+  configuration_state.incoming_mtu_ = initial_config.incoming_mtu;
+
+  auto fcs_option = std::make_unique<FrameCheckSequenceOption>();
+  fcs_option->fcs_type_ = FcsType::DEFAULT;
+  if (!link_->GetRemoteSupportsFcs()) {
+    fcs_option->fcs_type_ = FcsType::NO_FCS;
+    configuration_state.fcs_type_ = FcsType::NO_FCS;
+  }
+
+  auto retransmission_flow_control_configuration = std::make_unique<RetransmissionAndFlowControlConfigurationOption>();
   if (!link_->GetRemoteSupportsErtm()) {
     initial_config.channel_mode = DynamicChannelConfigurationOption::RetransmissionAndFlowControlMode::L2CAP_BASIC;
   }
-  auto mtu_configuration = std::make_unique<MtuConfigurationOption>();
-  mtu_configuration->mtu_ = initial_config.incoming_mtu;
-  auto fcs_option = std::make_unique<FrameCheckSequenceOption>();
-  fcs_option->fcs_type_ = FcsType::NO_FCS;
-  auto retransmission_flow_control_configuration = std::make_unique<RetransmissionAndFlowControlConfigurationOption>();
   switch (initial_config.channel_mode) {
     case DynamicChannelConfigurationOption::RetransmissionAndFlowControlMode::L2CAP_BASIC:
       retransmission_flow_control_configuration->mode_ = RetransmissionAndFlowControlModeOption::L2CAP_BASIC;
+      configuration_state.retransmission_and_flow_control_mode_ = RetransmissionAndFlowControlModeOption::L2CAP_BASIC;
       break;
     case DynamicChannelConfigurationOption::RetransmissionAndFlowControlMode::ENHANCED_RETRANSMISSION:
       retransmission_flow_control_configuration->mode_ =
           RetransmissionAndFlowControlModeOption::ENHANCED_RETRANSMISSION;
+      configuration_state.retransmission_and_flow_control_mode_ =
+          RetransmissionAndFlowControlModeOption::ENHANCED_RETRANSMISSION;
       // TODO: Decide where to put initial values
       retransmission_flow_control_configuration->tx_window_size_ = 10;
       retransmission_flow_control_configuration->max_transmit_ = 20;
@@ -172,9 +188,8 @@
       retransmission_flow_control_configuration->maximum_pdu_size_ = 1010;
       break;
   }
+  configuration_state.local_retransmission_and_flow_control_ = *retransmission_flow_control_configuration;
 
-  new_channel->SetRetransmissionFlowControlConfig(*retransmission_flow_control_configuration);
-  new_channel->SetIncomingMtu(initial_config.incoming_mtu);
   std::vector<std::unique_ptr<ConfigurationOption>> config;
   config.emplace_back(std::move(mtu_configuration));
   config.emplace_back(std::move(retransmission_flow_control_configuration));
@@ -211,20 +226,35 @@
     return;
   }
   alarm_.Cancel();
+
+  auto& configuration_state = channel_configuration_[new_channel->GetCid()];
   auto initial_config = link_->GetConfigurationForInitialConfiguration(new_channel->GetCid());
+
+  auto mtu_configuration = std::make_unique<MtuConfigurationOption>();
+  mtu_configuration->mtu_ = initial_config.incoming_mtu;
+  configuration_state.incoming_mtu_ = initial_config.incoming_mtu;
+
+  auto fcs_option = std::make_unique<FrameCheckSequenceOption>();
+  fcs_option->fcs_type_ = FcsType::DEFAULT;
+  if (!link_->GetRemoteSupportsFcs()) {
+    fcs_option->fcs_type_ = FcsType::NO_FCS;
+    configuration_state.fcs_type_ = FcsType::NO_FCS;
+  }
+
+  auto retransmission_flow_control_configuration = std::make_unique<RetransmissionAndFlowControlConfigurationOption>();
   if (!link_->GetRemoteSupportsErtm()) {
     initial_config.channel_mode = DynamicChannelConfigurationOption::RetransmissionAndFlowControlMode::L2CAP_BASIC;
   }
-  auto mtu_configuration = std::make_unique<MtuConfigurationOption>();
-  mtu_configuration->mtu_ = initial_config.incoming_mtu;
-  auto retransmission_flow_control_configuration = std::make_unique<RetransmissionAndFlowControlConfigurationOption>();
   switch (initial_config.channel_mode) {
     case DynamicChannelConfigurationOption::RetransmissionAndFlowControlMode::L2CAP_BASIC:
       retransmission_flow_control_configuration->mode_ = RetransmissionAndFlowControlModeOption::L2CAP_BASIC;
+      configuration_state.retransmission_and_flow_control_mode_ = RetransmissionAndFlowControlModeOption::L2CAP_BASIC;
       break;
     case DynamicChannelConfigurationOption::RetransmissionAndFlowControlMode::ENHANCED_RETRANSMISSION:
       retransmission_flow_control_configuration->mode_ =
           RetransmissionAndFlowControlModeOption::ENHANCED_RETRANSMISSION;
+      configuration_state.retransmission_and_flow_control_mode_ =
+          RetransmissionAndFlowControlModeOption::ENHANCED_RETRANSMISSION;
       // TODO: Decide where to put initial values
       retransmission_flow_control_configuration->tx_window_size_ = 10;
       retransmission_flow_control_configuration->max_transmit_ = 20;
@@ -233,11 +263,12 @@
       retransmission_flow_control_configuration->maximum_pdu_size_ = 1010;
       break;
   }
+  configuration_state.local_retransmission_and_flow_control_ = *retransmission_flow_control_configuration;
+
   std::vector<std::unique_ptr<ConfigurationOption>> config;
   config.emplace_back(std::move(mtu_configuration));
-  if (initial_config.channel_mode != DynamicChannelConfigurationOption::RetransmissionAndFlowControlMode::L2CAP_BASIC) {
-    config.emplace_back(std::move(retransmission_flow_control_configuration));
-  }
+  config.emplace_back(std::move(retransmission_flow_control_configuration));
+  config.emplace_back(std::move(fcs_option));
   SendConfigurationRequest(remote_cid, {});
 }
 
@@ -249,10 +280,13 @@
     return;
   }
 
+  auto& configuration_state = channel_configuration_[cid];
+
   for (auto& option : options) {
     switch (option->type_) {
       case ConfigurationOptionType::MTU: {
-        channel->SetIncomingMtu(MtuConfigurationOption::Specialize(option.get())->mtu_);
+        configuration_state.outgoing_mtu_ = MtuConfigurationOption::Specialize(option.get())->mtu_;
+        // TODO: If less than minimum (required by spec), reject
         break;
       }
       case ConfigurationOptionType::FLUSH_TIMEOUT: {
@@ -261,11 +295,11 @@
       }
       case ConfigurationOptionType::RETRANSMISSION_AND_FLOW_CONTROL: {
         auto config = RetransmissionAndFlowControlConfigurationOption::Specialize(option.get());
-        channel->SetRetransmissionFlowControlConfig(*config);
+        configuration_state.remote_retransmission_and_flow_control_ = *config;
         break;
       }
       case ConfigurationOptionType::FRAME_CHECK_SEQUENCE: {
-        channel->SetFcsType(FrameCheckSequenceOption::Specialize(option.get())->fcs_type_);
+        configuration_state.fcs_type_ = FrameCheckSequenceOption::Specialize(option.get())->fcs_type_;
         break;
       }
       default:
@@ -278,18 +312,22 @@
     }
   }
 
-  auto response = ConfigurationResponseBuilder::Create(signal_id.Value(), channel->GetRemoteCid(), is_continuation,
-                                                       ConfigurationResponseResult::SUCCESS, {});
-  enqueue_buffer_->Enqueue(std::move(response), handler_);
-  channel->SetIncomingConfigurationStatus(DynamicChannelImpl::ConfigurationStatus::CONFIGURED);
-  if (channel->GetOutgoingConfigurationStatus() == DynamicChannelImpl::ConfigurationStatus::CONFIGURED) {
+  if (configuration_state.state_ == ChannelConfigurationState::State::WAIT_CONFIG_REQ) {
     std::unique_ptr<DynamicChannel> user_channel = std::make_unique<DynamicChannel>(channel, handler_);
     if (channel->local_initiated_) {
       link_->NotifyChannelCreation(cid, std::move(user_channel));
     } else {
       dynamic_service_manager_->GetService(channel->GetPsm())->NotifyChannelCreation(std::move(user_channel));
     }
+    configuration_state.state_ = ChannelConfigurationState::State::CONFIGURED;
+    data_pipeline_manager_->UpdateClassicConfiguration(cid, configuration_state);
+  } else if (configuration_state.state_ == ChannelConfigurationState::State::WAIT_CONFIG_REQ_RSP) {
+    configuration_state.state_ = ChannelConfigurationState::State::WAIT_CONFIG_RSP;
   }
+
+  auto response = ConfigurationResponseBuilder::Create(signal_id.Value(), channel->GetRemoteCid(), is_continuation,
+                                                       ConfigurationResponseResult::SUCCESS, {});
+  enqueue_buffer_->Enqueue(std::move(response), handler_);
 }
 
 void ClassicSignallingManager::OnConfigurationResponse(SignalId signal_id, Cid cid, Continuation is_continuation,
@@ -310,15 +348,50 @@
     return;
   }
 
-  channel->SetOutgoingConfigurationStatus(DynamicChannelImpl::ConfigurationStatus::CONFIGURED);
-  if (channel->GetIncomingConfigurationStatus() == DynamicChannelImpl::ConfigurationStatus::CONFIGURED) {
+  // TODO: Handle status not SUCCESS
+
+  auto& configuration_state = channel_configuration_[channel->GetCid()];
+
+  for (auto& option : options) {
+    switch (option->type_) {
+      case ConfigurationOptionType::MTU: {
+        auto config = MtuConfigurationOption::Specialize(option.get());
+        configuration_state.incoming_mtu_ = config->mtu_;
+        break;
+      }
+      case ConfigurationOptionType::FLUSH_TIMEOUT: {
+        // TODO: Handle this configuration option
+        break;
+      }
+      case ConfigurationOptionType::RETRANSMISSION_AND_FLOW_CONTROL: {
+        auto config = RetransmissionAndFlowControlConfigurationOption::Specialize(option.get());
+        configuration_state.retransmission_and_flow_control_mode_ = config->mode_;
+        configuration_state.local_retransmission_and_flow_control_ = *config;
+        break;
+      }
+      case ConfigurationOptionType::FRAME_CHECK_SEQUENCE: {
+        configuration_state.fcs_type_ = FrameCheckSequenceOption::Specialize(option.get())->fcs_type_;
+        break;
+      }
+      default:
+        LOG_WARN("Received some unsupported configuration option: %d", static_cast<int>(option->type_));
+        return;
+    }
+  }
+
+  if (configuration_state.state_ == ChannelConfigurationState::State::WAIT_CONFIG_RSP) {
     std::unique_ptr<DynamicChannel> user_channel = std::make_unique<DynamicChannel>(channel, handler_);
     if (channel->local_initiated_) {
       link_->NotifyChannelCreation(cid, std::move(user_channel));
     } else {
       dynamic_service_manager_->GetService(channel->GetPsm())->NotifyChannelCreation(std::move(user_channel));
     }
+    configuration_state.state_ = ChannelConfigurationState::State::CONFIGURED;
+    data_pipeline_manager_->UpdateClassicConfiguration(cid, configuration_state);
+  } else if (configuration_state.state_ == ChannelConfigurationState::State::WAIT_CONFIG_REQ_RSP) {
+    configuration_state.state_ = ChannelConfigurationState::State::WAIT_CONFIG_REQ;
   }
+
   alarm_.Cancel();
   handle_send_next_command();
 }
diff --git a/gd/l2cap/classic/internal/signalling_manager.h b/gd/l2cap/classic/internal/signalling_manager.h
index 0e17ec7..81c8c31 100644
--- a/gd/l2cap/classic/internal/signalling_manager.h
+++ b/gd/l2cap/classic/internal/signalling_manager.h
@@ -21,10 +21,12 @@
 #include <vector>
 
 #include "l2cap/cid.h"
-#include "l2cap/classic/internal/dynamic_channel_allocator.h"
+#include "l2cap/classic/internal/channel_configuration_state.h"
 #include "l2cap/classic/internal/dynamic_channel_service_manager_impl.h"
 #include "l2cap/classic/internal/fixed_channel_impl.h"
 #include "l2cap/classic/internal/fixed_channel_service_manager_impl.h"
+#include "l2cap/internal/data_pipeline_manager.h"
+#include "l2cap/internal/dynamic_channel_allocator.h"
 #include "l2cap/l2cap_packets.h"
 #include "l2cap/psm.h"
 #include "l2cap/signal_id.h"
@@ -53,8 +55,9 @@
 class ClassicSignallingManager {
  public:
   ClassicSignallingManager(os::Handler* handler, Link* link,
+                           l2cap::internal::DataPipelineManager* data_pipeline_manager,
                            classic::internal::DynamicChannelServiceManagerImpl* dynamic_service_manager,
-                           classic::internal::DynamicChannelAllocator* channel_allocator,
+                           l2cap::internal::DynamicChannelAllocator* channel_allocator,
                            classic::internal::FixedChannelServiceManagerImpl* fixed_service_manager);
 
   virtual ~ClassicSignallingManager();
@@ -103,15 +106,17 @@
 
   os::Handler* handler_;
   Link* link_;
+  [[maybe_unused]] l2cap::internal::DataPipelineManager* data_pipeline_manager_;
   std::shared_ptr<classic::internal::FixedChannelImpl> signalling_channel_;
   DynamicChannelServiceManagerImpl* dynamic_service_manager_;
-  DynamicChannelAllocator* channel_allocator_;
+  l2cap::internal::DynamicChannelAllocator* channel_allocator_;
   FixedChannelServiceManagerImpl* fixed_service_manager_;
   std::unique_ptr<os::EnqueueBuffer<packet::BasePacketBuilder>> enqueue_buffer_;
   PendingCommand last_sent_command_;
   std::queue<PendingCommand> pending_commands_;
   os::Alarm alarm_;
   SignalId next_signal_id_ = kInitialSignalId;
+  std::unordered_map<Cid, ChannelConfigurationState> channel_configuration_;
 };
 
 }  // namespace internal
diff --git a/gd/l2cap/classic/dynamic_channel.cc b/gd/l2cap/dynamic_channel.cc
similarity index 73%
rename from gd/l2cap/classic/dynamic_channel.cc
rename to gd/l2cap/dynamic_channel.cc
index b888b91..f8b64e6 100644
--- a/gd/l2cap/classic/dynamic_channel.cc
+++ b/gd/l2cap/dynamic_channel.cc
@@ -14,13 +14,12 @@
  * limitations under the License.
  */
 
-#include "l2cap/classic/dynamic_channel.h"
+#include "l2cap/dynamic_channel.h"
 #include "common/bind.h"
-#include "l2cap/classic/internal/dynamic_channel_impl.h"
+#include "l2cap/internal/dynamic_channel_impl.h"
 
 namespace bluetooth {
 namespace l2cap {
-namespace classic {
 
 hci::Address DynamicChannel::GetDevice() const {
   return impl_->GetDevice();
@@ -28,18 +27,17 @@
 
 void DynamicChannel::RegisterOnCloseCallback(os::Handler* user_handler,
                                              DynamicChannel::OnCloseCallback on_close_callback) {
-  l2cap_handler_->Post(common::BindOnce(&internal::DynamicChannelImpl::RegisterOnCloseCallback, impl_, user_handler,
-                                        std::move(on_close_callback)));
+  l2cap_handler_->Post(common::BindOnce(&l2cap::internal::DynamicChannelImpl::RegisterOnCloseCallback, impl_,
+                                        user_handler, std::move(on_close_callback)));
 }
 
 void DynamicChannel::Close() {
-  l2cap_handler_->Post(common::BindOnce(&internal::DynamicChannelImpl::Close, impl_));
+  l2cap_handler_->Post(common::BindOnce(&l2cap::internal::DynamicChannelImpl::Close, impl_));
 }
 
 common::BidiQueueEnd<packet::BasePacketBuilder, packet::PacketView<packet::kLittleEndian>>*
 DynamicChannel::GetQueueUpEnd() const {
   return impl_->GetQueueUpEnd();
 }
-}  // namespace classic
 }  // namespace l2cap
 }  // namespace bluetooth
\ No newline at end of file
diff --git a/gd/l2cap/classic/dynamic_channel.h b/gd/l2cap/dynamic_channel.h
similarity index 92%
rename from gd/l2cap/classic/dynamic_channel.h
rename to gd/l2cap/dynamic_channel.h
index eb52c16..b7496f8 100644
--- a/gd/l2cap/classic/dynamic_channel.h
+++ b/gd/l2cap/dynamic_channel.h
@@ -24,7 +24,6 @@
 
 namespace bluetooth {
 namespace l2cap {
-namespace classic {
 
 namespace internal {
 class DynamicChannelImpl;
@@ -37,7 +36,7 @@
 class DynamicChannel {
  public:
   // Should only be constructed by modules that have access to LinkManager
-  DynamicChannel(std::shared_ptr<internal::DynamicChannelImpl> impl, os::Handler* l2cap_handler)
+  DynamicChannel(std::shared_ptr<l2cap::internal::DynamicChannelImpl> impl, os::Handler* l2cap_handler)
       : impl_(std::move(impl)), l2cap_handler_(l2cap_handler) {
     ASSERT(impl_ != nullptr);
     ASSERT(l2cap_handler_ != nullptr);
@@ -72,10 +71,9 @@
   common::BidiQueueEnd<packet::BasePacketBuilder, packet::PacketView<packet::kLittleEndian>>* GetQueueUpEnd() const;
 
  private:
-  std::shared_ptr<internal::DynamicChannelImpl> impl_;
+  std::shared_ptr<l2cap::internal::DynamicChannelImpl> impl_;
   os::Handler* l2cap_handler_;
 };
 
-}  // namespace classic
 }  // namespace l2cap
 }  // namespace bluetooth
diff --git a/gd/l2cap/internal/channel_impl.h b/gd/l2cap/internal/channel_impl.h
index ae17660..427a15f 100644
--- a/gd/l2cap/internal/channel_impl.h
+++ b/gd/l2cap/internal/channel_impl.h
@@ -47,13 +47,6 @@
   virtual Cid GetCid() const = 0;
 
   virtual Cid GetRemoteCid() const = 0;
-
-  /**
-   * Callback from the Scheduler to notify the Sender for this channel. On config update, channel might notify the
-   * configuration change to Sender.
-   * Fixed channel doesn't need to implement it, as it doesn't need to send config update to Sender.
-   */
-  virtual void SetSender(l2cap::internal::Sender* sender) = 0;
 };
 
 }  // namespace internal
diff --git a/gd/l2cap/internal/channel_impl_mock.h b/gd/l2cap/internal/channel_impl_mock.h
index 710e69a..4430487 100644
--- a/gd/l2cap/internal/channel_impl_mock.h
+++ b/gd/l2cap/internal/channel_impl_mock.h
@@ -34,7 +34,6 @@
               GetQueueDownEnd, (), (override));
   MOCK_METHOD(Cid, GetCid, (), (const, override));
   MOCK_METHOD(Cid, GetRemoteCid, (), (const, override));
-  MOCK_METHOD(void, SetSender, (l2cap::internal::Sender*), (override));
 };
 
 }  // namespace testing
diff --git a/gd/l2cap/internal/data_controller_mock.h b/gd/l2cap/internal/data_controller_mock.h
new file mode 100644
index 0000000..d071c68
--- /dev/null
+++ b/gd/l2cap/internal/data_controller_mock.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "l2cap/internal/data_controller.h"
+
+#include <gmock/gmock.h>
+
+// Unit test interfaces
+namespace bluetooth {
+namespace l2cap {
+namespace internal {
+namespace testing {
+
+class MockDataController : public DataController {
+ public:
+  MOCK_METHOD(void, OnSdu, (std::unique_ptr<packet::BasePacketBuilder>), (override));
+  MOCK_METHOD(void, OnPdu, (packet::PacketView<true>), (override));
+  MOCK_METHOD(std::unique_ptr<packet::BasePacketBuilder>, GetNextPacket, (), (override));
+  MOCK_METHOD(void, EnableFcs, (bool), (override));
+  MOCK_METHOD(void, SetRetransmissionAndFlowControlOptions, (const RetransmissionAndFlowControlConfigurationOption&),
+              (override));
+};
+
+}  // namespace testing
+}  // namespace internal
+}  // namespace l2cap
+}  // namespace bluetooth
diff --git a/gd/l2cap/internal/data_pipeline_manager.cc b/gd/l2cap/internal/data_pipeline_manager.cc
new file mode 100644
index 0000000..1c8d973
--- /dev/null
+++ b/gd/l2cap/internal/data_pipeline_manager.cc
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2019 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 <unordered_map>
+
+#include "l2cap/cid.h"
+#include "l2cap/internal/channel_impl.h"
+#include "l2cap/internal/data_controller.h"
+#include "l2cap/internal/data_pipeline_manager.h"
+#include "os/log.h"
+
+namespace bluetooth {
+namespace l2cap {
+namespace internal {
+
+void DataPipelineManager::AttachChannel(Cid cid, std::shared_ptr<ChannelImpl> channel) {
+  ASSERT(sender_map_.find(cid) == sender_map_.end());
+  sender_map_.emplace(std::piecewise_construct, std::forward_as_tuple(cid),
+                      std::forward_as_tuple(handler_, scheduler_.get(), channel));
+}
+
+void DataPipelineManager::DetachChannel(Cid cid) {
+  ASSERT(sender_map_.find(cid) != sender_map_.end());
+  sender_map_.erase(cid);
+}
+
+DataController* DataPipelineManager::GetDataController(Cid cid) {
+  ASSERT(sender_map_.find(cid) != sender_map_.end());
+  return sender_map_.find(cid)->second.GetDataController();
+}
+
+void DataPipelineManager::OnPacketSent(Cid cid) {
+  ASSERT(sender_map_.find(cid) != sender_map_.end());
+  sender_map_.find(cid)->second.OnPacketSent();
+}
+
+void DataPipelineManager::UpdateClassicConfiguration(Cid cid, classic::internal::ChannelConfigurationState config) {
+  ASSERT(sender_map_.find(cid) != sender_map_.end());
+  sender_map_.find(cid)->second.UpdateClassicConfiguration(config);
+}
+
+}  // namespace internal
+}  // namespace l2cap
+}  // namespace bluetooth
diff --git a/gd/l2cap/internal/data_pipeline_manager.h b/gd/l2cap/internal/data_pipeline_manager.h
new file mode 100644
index 0000000..fffbfc7
--- /dev/null
+++ b/gd/l2cap/internal/data_pipeline_manager.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <string>
+#include <unordered_map>
+
+#include "common/bidi_queue.h"
+#include "common/bind.h"
+#include "data_controller.h"
+#include "l2cap/cid.h"
+#include "l2cap/classic/internal/channel_configuration_state.h"
+#include "l2cap/internal/channel_impl.h"
+#include "l2cap/internal/receiver.h"
+#include "l2cap/internal/scheduler.h"
+#include "l2cap/internal/scheduler_fifo.h"
+#include "l2cap/l2cap_packets.h"
+#include "l2cap/mtu.h"
+#include "os/handler.h"
+#include "os/log.h"
+#include "os/queue.h"
+#include "packet/base_packet_builder.h"
+#include "packet/packet_view.h"
+
+namespace bluetooth {
+namespace l2cap {
+namespace internal {
+
+/**
+ * Manages data pipeline from channel queue end to link queue end, per link.
+ * Contains a Scheduler and Receiver per link.
+ * Contains a Sender and its corrsponding DataController per attached channel.
+ */
+class DataPipelineManager {
+ public:
+  using UpperEnqueue = packet::PacketView<packet::kLittleEndian>;
+  using UpperDequeue = packet::BasePacketBuilder;
+  using UpperQueueDownEnd = common::BidiQueueEnd<UpperEnqueue, UpperDequeue>;
+  using LowerEnqueue = UpperDequeue;
+  using LowerDequeue = UpperEnqueue;
+  using LowerQueueUpEnd = common::BidiQueueEnd<LowerEnqueue, LowerDequeue>;
+
+  DataPipelineManager(os::Handler* handler, LowerQueueUpEnd* link_queue_up_end)
+      : handler_(handler), scheduler_(std::make_unique<Fifo>(this, link_queue_up_end, handler)),
+        receiver_(link_queue_up_end, handler, this) {}
+
+  virtual void AttachChannel(Cid cid, std::shared_ptr<ChannelImpl> channel);
+  virtual void DetachChannel(Cid cid);
+  virtual DataController* GetDataController(Cid cid);
+  virtual void OnPacketSent(Cid cid);
+  virtual void UpdateClassicConfiguration(Cid cid, classic::internal::ChannelConfigurationState config);
+  virtual ~DataPipelineManager() = default;
+
+ private:
+  os::Handler* handler_;
+  std::unique_ptr<Scheduler> scheduler_;
+  Receiver receiver_;
+  std::unordered_map<Cid, Sender> sender_map_;
+};
+}  // namespace internal
+}  // namespace l2cap
+}  // namespace bluetooth
diff --git a/gd/l2cap/internal/data_pipeline_manager_mock.h b/gd/l2cap/internal/data_pipeline_manager_mock.h
new file mode 100644
index 0000000..f5a24f4
--- /dev/null
+++ b/gd/l2cap/internal/data_pipeline_manager_mock.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "l2cap/internal/data_pipeline_manager.h"
+
+#include "l2cap/internal/channel_impl.h"
+#include "l2cap/internal/data_controller.h"
+
+#include <gmock/gmock.h>
+
+// Unit test interfaces
+namespace bluetooth {
+namespace l2cap {
+namespace internal {
+namespace testing {
+
+class MockDataPipelineManager : public DataPipelineManager {
+ public:
+  MockDataPipelineManager(os::Handler* handler, LowerQueueUpEnd* link_queue_up_end)
+      : DataPipelineManager(handler, link_queue_up_end) {}
+  MOCK_METHOD(void, AttachChannel, (Cid, std::shared_ptr<ChannelImpl>), (override));
+  MOCK_METHOD(void, DetachChannel, (Cid), (override));
+  MOCK_METHOD(DataController*, GetDataController, (Cid), (override));
+  MOCK_METHOD(void, OnPacketSent, (Cid), (override));
+};
+
+}  // namespace testing
+}  // namespace internal
+}  // namespace l2cap
+}  // namespace bluetooth
diff --git a/gd/l2cap/classic/internal/dynamic_channel_allocator.cc b/gd/l2cap/internal/dynamic_channel_allocator.cc
similarity index 97%
rename from gd/l2cap/classic/internal/dynamic_channel_allocator.cc
rename to gd/l2cap/internal/dynamic_channel_allocator.cc
index 95830e0..6f00274 100644
--- a/gd/l2cap/classic/internal/dynamic_channel_allocator.cc
+++ b/gd/l2cap/internal/dynamic_channel_allocator.cc
@@ -17,15 +17,14 @@
 #include <unordered_map>
 
 #include "l2cap/cid.h"
-#include "l2cap/classic/internal/dynamic_channel_allocator.h"
 #include "l2cap/classic/internal/link.h"
+#include "l2cap/internal/dynamic_channel_allocator.h"
+#include "l2cap/internal/dynamic_channel_impl.h"
 #include "l2cap/security_policy.h"
-#include "os/handler.h"
 #include "os/log.h"
 
 namespace bluetooth {
 namespace l2cap {
-namespace classic {
 namespace internal {
 
 std::shared_ptr<DynamicChannelImpl> DynamicChannelAllocator::AllocateChannel(Psm psm, Cid remote_cid,
@@ -135,6 +134,5 @@
 }
 
 }  // namespace internal
-}  // namespace classic
 }  // namespace l2cap
 }  // namespace bluetooth
diff --git a/gd/l2cap/classic/internal/dynamic_channel_allocator.h b/gd/l2cap/internal/dynamic_channel_allocator.h
similarity index 90%
rename from gd/l2cap/classic/internal/dynamic_channel_allocator.h
rename to gd/l2cap/internal/dynamic_channel_allocator.h
index 57e0f90..09a3588 100644
--- a/gd/l2cap/classic/internal/dynamic_channel_allocator.h
+++ b/gd/l2cap/internal/dynamic_channel_allocator.h
@@ -19,8 +19,9 @@
 #include <unordered_map>
 #include <unordered_set>
 
+#include "hci/acl_manager.h"
 #include "l2cap/cid.h"
-#include "l2cap/classic/internal/dynamic_channel_impl.h"
+#include "l2cap/internal/ilink.h"
 #include "l2cap/psm.h"
 #include "l2cap/security_policy.h"
 #include "os/handler.h"
@@ -28,16 +29,16 @@
 
 namespace bluetooth {
 namespace l2cap {
-namespace classic {
 namespace internal {
 
-class Link;
+class DynamicChannelImpl;
 
 // Helper class for keeping channels in a Link. It allocates and frees Channel object, and supports querying whether a
 // channel is in use
 class DynamicChannelAllocator {
  public:
-  DynamicChannelAllocator(Link* link, os::Handler* l2cap_handler) : link_(link), l2cap_handler_(l2cap_handler) {
+  DynamicChannelAllocator(l2cap::internal::ILink* link, os::Handler* l2cap_handler)
+      : link_(link), l2cap_handler_(l2cap_handler) {
     ASSERT(link_ != nullptr);
     ASSERT(l2cap_handler_ != nullptr);
   }
@@ -67,7 +68,7 @@
   void OnAclDisconnected(hci::ErrorCode hci_status);
 
  private:
-  Link* link_;
+  l2cap::internal::ILink* link_;
   os::Handler* l2cap_handler_;
   std::unordered_set<Cid> used_cid_;
   std::unordered_map<Cid, std::shared_ptr<DynamicChannelImpl>> channels_;
@@ -75,6 +76,5 @@
 };
 
 }  // namespace internal
-}  // namespace classic
 }  // namespace l2cap
 }  // namespace bluetooth
diff --git a/gd/l2cap/classic/internal/dynamic_channel_allocator_fuzz_test.cc b/gd/l2cap/internal/dynamic_channel_allocator_fuzz_test.cc
similarity index 85%
rename from gd/l2cap/classic/internal/dynamic_channel_allocator_fuzz_test.cc
rename to gd/l2cap/internal/dynamic_channel_allocator_fuzz_test.cc
index 80d1518..c3821dc 100644
--- a/gd/l2cap/classic/internal/dynamic_channel_allocator_fuzz_test.cc
+++ b/gd/l2cap/internal/dynamic_channel_allocator_fuzz_test.cc
@@ -14,25 +14,24 @@
  * limitations under the License.
  */
 
-#include "l2cap/classic/internal/dynamic_channel_allocator.h"
 #include "l2cap/classic/internal/link_mock.h"
+#include "l2cap/internal/dynamic_channel_allocator.h"
 #include "l2cap/internal/parameter_provider_mock.h"
 
 #include <gmock/gmock.h>
 
 namespace bluetooth {
 namespace l2cap {
-namespace classic {
 namespace internal {
 
+using classic::internal::testing::MockLink;
 using hci::testing::MockAclConnection;
 using l2cap::internal::testing::MockParameterProvider;
 using l2cap::internal::testing::MockScheduler;
-using testing::MockLink;
 using ::testing::NiceMock;
 using ::testing::Return;
 
-const hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}};
+const hci::AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_IDENTITY_ADDRESS};
 
 class L2capClassicDynamicChannelAllocatorFuzzTest {
  public:
@@ -48,8 +47,7 @@
     handler_ = new os::Handler(thread_);
     mock_parameter_provider_ = new NiceMock<MockParameterProvider>();
     mock_classic_link_ =
-        new NiceMock<MockLink>(handler_, mock_parameter_provider_, std::make_unique<NiceMock<MockAclConnection>>(),
-                               std::make_unique<NiceMock<MockScheduler>>());
+        new NiceMock<MockLink>(handler_, mock_parameter_provider_, std::make_unique<NiceMock<MockAclConnection>>());
     EXPECT_CALL(*mock_classic_link_, GetDevice()).WillRepeatedly(Return(device));
     channel_allocator_ = std::make_unique<DynamicChannelAllocator>(mock_classic_link_, handler_);
   }
@@ -79,11 +77,10 @@
 };
 
 }  // namespace internal
-}  // namespace classic
 }  // namespace l2cap
 }  // namespace bluetooth
 
 void RunL2capClassicDynamicChannelAllocatorFuzzTest(const uint8_t* data, size_t size) {
-  bluetooth::l2cap::classic::internal::L2capClassicDynamicChannelAllocatorFuzzTest test;
+  bluetooth::l2cap::internal::L2capClassicDynamicChannelAllocatorFuzzTest test;
   test.RunTests(data, size);
 }
\ No newline at end of file
diff --git a/gd/l2cap/classic/internal/dynamic_channel_allocator_test.cc b/gd/l2cap/internal/dynamic_channel_allocator_test.cc
similarity index 93%
rename from gd/l2cap/classic/internal/dynamic_channel_allocator_test.cc
rename to gd/l2cap/internal/dynamic_channel_allocator_test.cc
index 8e3f66b..4fc0160 100644
--- a/gd/l2cap/classic/internal/dynamic_channel_allocator_test.cc
+++ b/gd/l2cap/internal/dynamic_channel_allocator_test.cc
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "l2cap/classic/internal/dynamic_channel_allocator.h"
+#include "l2cap/internal/dynamic_channel_allocator.h"
 #include "l2cap/classic/internal/link_mock.h"
 #include "l2cap/internal/parameter_provider_mock.h"
 
@@ -23,14 +23,13 @@
 
 namespace bluetooth {
 namespace l2cap {
-namespace classic {
 namespace internal {
 
+using classic::internal::testing::MockLink;
 using l2cap::internal::testing::MockParameterProvider;
-using testing::MockLink;
 using ::testing::Return;
 
-const hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}};
+const hci::AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_IDENTITY_ADDRESS};
 
 class L2capClassicDynamicChannelAllocatorTest : public ::testing::Test {
  protected:
@@ -89,6 +88,5 @@
 }
 
 }  // namespace internal
-}  // namespace classic
 }  // namespace l2cap
 }  // namespace bluetooth
diff --git a/gd/l2cap/classic/internal/dynamic_channel_impl.cc b/gd/l2cap/internal/dynamic_channel_impl.cc
similarity index 70%
rename from gd/l2cap/classic/internal/dynamic_channel_impl.cc
rename to gd/l2cap/internal/dynamic_channel_impl.cc
index c0614f9..947a32f 100644
--- a/gd/l2cap/classic/internal/dynamic_channel_impl.cc
+++ b/gd/l2cap/internal/dynamic_channel_impl.cc
@@ -17,8 +17,8 @@
 #include <unordered_map>
 
 #include "l2cap/cid.h"
-#include "l2cap/classic/internal/dynamic_channel_impl.h"
 #include "l2cap/classic/internal/link.h"
+#include "l2cap/internal/dynamic_channel_impl.h"
 #include "l2cap/internal/sender.h"
 #include "l2cap/psm.h"
 #include "l2cap/security_policy.h"
@@ -27,10 +27,10 @@
 
 namespace bluetooth {
 namespace l2cap {
-namespace classic {
 namespace internal {
 
-DynamicChannelImpl::DynamicChannelImpl(Psm psm, Cid cid, Cid remote_cid, Link* link, os::Handler* l2cap_handler)
+DynamicChannelImpl::DynamicChannelImpl(Psm psm, Cid cid, Cid remote_cid, l2cap::internal::ILink* link,
+                                       os::Handler* l2cap_handler)
     : psm_(psm), cid_(cid), remote_cid_(remote_cid), link_(link), l2cap_handler_(l2cap_handler),
       device_(link->GetDevice()) {
   ASSERT(IsPsmValid(psm_));
@@ -41,7 +41,7 @@
 }
 
 hci::Address DynamicChannelImpl::GetDevice() const {
-  return device_;
+  return device_.GetAddress();
 }
 
 void DynamicChannelImpl::RegisterOnCloseCallback(os::Handler* user_handler,
@@ -82,40 +82,6 @@
   return ss.str();
 }
 
-DynamicChannelImpl::ConfigurationStatus DynamicChannelImpl::GetOutgoingConfigurationStatus() const {
-  return outgoing_configuration_status_;
-}
-
-void DynamicChannelImpl::SetOutgoingConfigurationStatus(ConfigurationStatus status) {
-  outgoing_configuration_status_ = status;
-}
-
-DynamicChannelImpl::ConfigurationStatus DynamicChannelImpl::GetIncomingConfigurationStatus() const {
-  return incoming_configuration_status_;
-}
-
-void DynamicChannelImpl::SetIncomingConfigurationStatus(ConfigurationStatus status) {
-  incoming_configuration_status_ = status;
-}
-
-void DynamicChannelImpl::SetSender(l2cap::internal::Sender* sender) {
-  sender_ = sender;
-}
-
-void DynamicChannelImpl::SetIncomingMtu(Mtu mtu) {
-  sender_->SetIncomingMtu(mtu);
-}
-
-void DynamicChannelImpl::SetRetransmissionFlowControlConfig(
-    const RetransmissionAndFlowControlConfigurationOption& option) {
-  sender_->SetChannelRetransmissionFlowControlMode(option);
-}
-
-void DynamicChannelImpl::SetFcsType(FcsType fcs_type) {
-  sender_->SetFcsType(fcs_type);
-}
-
 }  // namespace internal
-}  // namespace classic
 }  // namespace l2cap
 }  // namespace bluetooth
diff --git a/gd/l2cap/classic/internal/dynamic_channel_impl.h b/gd/l2cap/internal/dynamic_channel_impl.h
similarity index 67%
rename from gd/l2cap/classic/internal/dynamic_channel_impl.h
rename to gd/l2cap/internal/dynamic_channel_impl.h
index 95be5c7..856e21d 100644
--- a/gd/l2cap/classic/internal/dynamic_channel_impl.h
+++ b/gd/l2cap/internal/dynamic_channel_impl.h
@@ -19,8 +19,9 @@
 #include "common/bidi_queue.h"
 #include "hci/address.h"
 #include "l2cap/cid.h"
-#include "l2cap/classic/dynamic_channel.h"
+#include "l2cap/dynamic_channel.h"
 #include "l2cap/internal/channel_impl.h"
+#include "l2cap/internal/ilink.h"
 #include "l2cap/l2cap_packets.h"
 #include "l2cap/mtu.h"
 #include "l2cap/psm.h"
@@ -29,14 +30,11 @@
 
 namespace bluetooth {
 namespace l2cap {
-namespace classic {
 namespace internal {
 
-class Link;
-
 class DynamicChannelImpl : public l2cap::internal::ChannelImpl {
  public:
-  DynamicChannelImpl(Psm psm, Cid cid, Cid remote_cid, Link* link, os::Handler* l2cap_handler);
+  DynamicChannelImpl(Psm psm, Cid cid, Cid remote_cid, l2cap::internal::ILink* link, os::Handler* l2cap_handler);
 
   virtual ~DynamicChannelImpl() = default;
 
@@ -68,26 +66,6 @@
     return psm_;
   }
 
-  enum class ConfigurationStatus { NOT_CONFIGURED, CONFIGURED };
-
-  virtual ConfigurationStatus GetOutgoingConfigurationStatus() const;
-  virtual void SetOutgoingConfigurationStatus(ConfigurationStatus status);
-
-  virtual ConfigurationStatus GetIncomingConfigurationStatus() const;
-  virtual void SetIncomingConfigurationStatus(ConfigurationStatus status);
-
-  /**
-   * Callback from the Scheduler to notify the Sender for this channel. On config update, channel might notify the
-   * configuration to Sender
-   */
-  void SetSender(l2cap::internal::Sender* sender) override;
-
-  virtual void SetIncomingMtu(Mtu mtu);
-
-  virtual void SetRetransmissionFlowControlConfig(const RetransmissionAndFlowControlConfigurationOption& mode);
-
-  virtual void SetFcsType(FcsType fcs_type);
-
   // TODO(cmanton) Do something a little bit better than this
   bool local_initiated_{false};
 
@@ -95,9 +73,9 @@
   const Psm psm_;
   const Cid cid_;
   const Cid remote_cid_;
-  Link* link_;
+  l2cap::internal::ILink* link_;
   os::Handler* l2cap_handler_;
-  const hci::Address device_;
+  const hci::AddressWithType device_;
 
   // User supported states
   os::Handler* user_handler_ = nullptr;
@@ -109,15 +87,10 @@
   static constexpr size_t kChannelQueueSize = 10;
   common::BidiQueue<packet::PacketView<packet::kLittleEndian>, packet::BasePacketBuilder> channel_queue_{
       kChannelQueueSize};
-  ConfigurationStatus outgoing_configuration_status_ = ConfigurationStatus::NOT_CONFIGURED;
-  ConfigurationStatus incoming_configuration_status_ = ConfigurationStatus::NOT_CONFIGURED;
-
-  l2cap::internal::Sender* sender_ = nullptr;
 
   DISALLOW_COPY_AND_ASSIGN(DynamicChannelImpl);
 };
 
 }  // namespace internal
-}  // namespace classic
 }  // namespace l2cap
 }  // namespace bluetooth
diff --git a/gd/l2cap/classic/internal/dynamic_channel_impl_test.cc b/gd/l2cap/internal/dynamic_channel_impl_test.cc
similarity index 89%
rename from gd/l2cap/classic/internal/dynamic_channel_impl_test.cc
rename to gd/l2cap/internal/dynamic_channel_impl_test.cc
index 2f6c649e..677b504 100644
--- a/gd/l2cap/classic/internal/dynamic_channel_impl_test.cc
+++ b/gd/l2cap/internal/dynamic_channel_impl_test.cc
@@ -13,7 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include "l2cap/classic/internal/dynamic_channel_impl.h"
+
+#include "l2cap/internal/dynamic_channel_impl.h"
 
 #include "common/testing/bind_test_util.h"
 #include "l2cap/cid.h"
@@ -26,11 +27,10 @@
 
 namespace bluetooth {
 namespace l2cap {
-namespace classic {
 namespace internal {
 
+using classic::internal::testing::MockLink;
 using l2cap::internal::testing::MockParameterProvider;
-using testing::MockLink;
 using ::testing::Return;
 
 class L2capClassicDynamicChannelImplTest : public ::testing::Test {
@@ -61,17 +61,17 @@
 TEST_F(L2capClassicDynamicChannelImplTest, get_device) {
   MockParameterProvider mock_parameter_provider;
   MockLink mock_classic_link(l2cap_handler_, &mock_parameter_provider);
-  hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}};
+  const hci::AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_IDENTITY_ADDRESS};
   EXPECT_CALL(mock_classic_link, GetDevice()).WillRepeatedly(Return(device));
   DynamicChannelImpl dynamic_channel_impl(0x01, kFirstDynamicChannel, kFirstDynamicChannel, &mock_classic_link,
                                           l2cap_handler_);
-  EXPECT_EQ(device, dynamic_channel_impl.GetDevice());
+  EXPECT_EQ(device.GetAddress(), dynamic_channel_impl.GetDevice());
 }
 
 TEST_F(L2capClassicDynamicChannelImplTest, close_triggers_callback) {
   MockParameterProvider mock_parameter_provider;
   MockLink mock_classic_link(l2cap_handler_, &mock_parameter_provider);
-  hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}};
+  const hci::AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_IDENTITY_ADDRESS};
   EXPECT_CALL(mock_classic_link, GetDevice()).WillRepeatedly(Return(device));
   DynamicChannelImpl dynamic_channel_impl(0x01, kFirstDynamicChannel, kFirstDynamicChannel, &mock_classic_link,
                                           l2cap_handler_);
@@ -93,7 +93,7 @@
 TEST_F(L2capClassicDynamicChannelImplTest, register_callback_after_close_should_call_immediately) {
   MockParameterProvider mock_parameter_provider;
   MockLink mock_classic_link(l2cap_handler_, &mock_parameter_provider);
-  hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}};
+  const hci::AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_IDENTITY_ADDRESS};
   EXPECT_CALL(mock_classic_link, GetDevice()).WillRepeatedly(Return(device));
   DynamicChannelImpl dynamic_channel_impl(0x01, kFirstDynamicChannel, kFirstDynamicChannel, &mock_classic_link,
                                           l2cap_handler_);
@@ -115,7 +115,7 @@
 TEST_F(L2capClassicDynamicChannelImplTest, close_twice_should_fail) {
   MockParameterProvider mock_parameter_provider;
   MockLink mock_classic_link(l2cap_handler_, &mock_parameter_provider);
-  hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}};
+  const hci::AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_IDENTITY_ADDRESS};
   EXPECT_CALL(mock_classic_link, GetDevice()).WillRepeatedly(Return(device));
   DynamicChannelImpl dynamic_channel_impl(0x01, kFirstDynamicChannel, kFirstDynamicChannel, &mock_classic_link,
                                           l2cap_handler_);
@@ -140,7 +140,7 @@
 TEST_F(L2capClassicDynamicChannelImplTest, multiple_registeration_should_fail) {
   MockParameterProvider mock_parameter_provider;
   MockLink mock_classic_link(l2cap_handler_, &mock_parameter_provider);
-  hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}};
+  const hci::AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_IDENTITY_ADDRESS};
   EXPECT_CALL(mock_classic_link, GetDevice()).WillRepeatedly(Return(device));
   DynamicChannelImpl dynamic_channel_impl(0x01, kFirstDynamicChannel, kFirstDynamicChannel, &mock_classic_link,
                                           l2cap_handler_);
@@ -159,6 +159,5 @@
 }
 
 }  // namespace internal
-}  // namespace classic
 }  // namespace l2cap
 }  // namespace bluetooth
diff --git a/gd/l2cap/internal/enhanced_retransmission_mode_channel_data_controller.cc b/gd/l2cap/internal/enhanced_retransmission_mode_channel_data_controller.cc
index 2a1b930..97f9702 100644
--- a/gd/l2cap/internal/enhanced_retransmission_mode_channel_data_controller.cc
+++ b/gd/l2cap/internal/enhanced_retransmission_mode_channel_data_controller.cc
@@ -168,20 +168,20 @@
     }
   }
 
-  void recv_i_frame(Final f, uint8_t tx_seq, uint8_t req_seq, SegmentationAndReassembly sar,
+  void recv_i_frame(Final f, uint8_t tx_seq, uint8_t req_seq, SegmentationAndReassembly sar, uint16_t sdu_size,
                     const packet::PacketView<true>& payload) {
     if (rx_state_ == RxState::RECV) {
       if (f == Final::NOT_SET && with_expected_tx_seq(tx_seq) && with_valid_req_seq(req_seq) && with_valid_f_bit(f) &&
           !local_busy()) {
         increment_expected_tx_seq();
         pass_to_tx(req_seq, f);
-        data_indication(sar, payload);
+        data_indication(sar, sdu_size, payload);
         send_ack(Final::NOT_SET);
       } else if (f == Final::POLL_RESPONSE && with_expected_tx_seq(tx_seq) && with_valid_req_seq(req_seq) &&
                  with_valid_f_bit(f) && !local_busy()) {
         increment_expected_tx_seq();
         pass_to_tx(req_seq, f);
-        data_indication(sar, payload);
+        data_indication(sar, sdu_size, payload);
         if (!rej_actioned_) {
           retransmit_i_frames(req_seq);
           send_pending_i_frames();
@@ -216,14 +216,14 @@
       if (f == Final::NOT_SET && with_expected_tx_seq(tx_seq) && with_valid_req_seq(req_seq) && with_valid_f_bit(f)) {
         increment_expected_tx_seq();
         pass_to_tx(req_seq, f);
-        data_indication(sar, payload);
+        data_indication(sar, sdu_size, payload);
         send_ack(Final::NOT_SET);
         rx_state_ = RxState::RECV;
       } else if (f == Final::POLL_RESPONSE && with_expected_tx_seq(tx_seq) && with_valid_req_seq(req_seq) &&
                  with_valid_f_bit(f)) {
         increment_expected_tx_seq();
         pass_to_tx(req_seq, f);
-        data_indication(sar, payload);
+        data_indication(sar, sdu_size, payload);
         if (!rej_actioned_) {
           retransmit_i_frames(req_seq);
           send_pending_i_frames();
@@ -682,8 +682,8 @@
     recv_f_bit(f);
   }
 
-  void data_indication(SegmentationAndReassembly sar, const packet::PacketView<true>& segment) {
-    controller_->stage_for_reassembly(sar, segment);
+  void data_indication(SegmentationAndReassembly sar, uint16_t sdu_size, const packet::PacketView<true>& segment) {
+    controller_->stage_for_reassembly(sar, sdu_size, segment);
     buffer_seq_ = (buffer_seq_ + 1) % kMaxTxWin;
   }
 
@@ -825,8 +825,21 @@
       LOG_WARN("Received invalid frame");
       return;
     }
-    pimpl_->recv_i_frame(i_frame_view.GetF(), i_frame_view.GetTxSeq(), i_frame_view.GetReqSeq(), i_frame_view.GetSar(),
-                         i_frame_view.GetPayload());
+    Final f = i_frame_view.GetF();
+    uint8_t tx_seq = i_frame_view.GetTxSeq();
+    uint8_t req_seq = i_frame_view.GetReqSeq();
+    auto sar = i_frame_view.GetSar();
+    if (sar == SegmentationAndReassembly::START) {
+      auto i_frame_start_view = EnhancedInformationStartFrameView::Create(i_frame_view);
+      if (!i_frame_start_view.IsValid()) {
+        LOG_WARN("Received invalid I-Frame START");
+        return;
+      }
+      pimpl_->recv_i_frame(f, tx_seq, req_seq, sar, i_frame_start_view.GetL2capSduLength(),
+                           i_frame_start_view.GetPayload());
+    } else {
+      pimpl_->recv_i_frame(f, tx_seq, req_seq, sar, 0, i_frame_view.GetPayload());
+    }
   } else if (type == FrameType::S_FRAME) {
     auto s_frame_view = EnhancedSupervisoryFrameView::Create(standard_frame_view);
     if (!s_frame_view.IsValid()) {
@@ -872,8 +885,21 @@
       LOG_WARN("Received invalid frame");
       return;
     }
-    pimpl_->recv_i_frame(i_frame_view.GetF(), i_frame_view.GetTxSeq(), i_frame_view.GetReqSeq(), i_frame_view.GetSar(),
-                         i_frame_view.GetPayload());
+    Final f = i_frame_view.GetF();
+    uint8_t tx_seq = i_frame_view.GetTxSeq();
+    uint8_t req_seq = i_frame_view.GetReqSeq();
+    auto sar = i_frame_view.GetSar();
+    if (sar == SegmentationAndReassembly::START) {
+      auto i_frame_start_view = EnhancedInformationStartFrameWithFcsView::Create(i_frame_view);
+      if (!i_frame_start_view.IsValid()) {
+        LOG_WARN("Received invalid I-Frame START");
+        return;
+      }
+      pimpl_->recv_i_frame(f, tx_seq, req_seq, sar, i_frame_start_view.GetL2capSduLength(),
+                           i_frame_start_view.GetPayload());
+    } else {
+      pimpl_->recv_i_frame(f, tx_seq, req_seq, sar, 0, i_frame_view.GetPayload());
+    }
   } else if (type == FrameType::S_FRAME) {
     auto s_frame_view = EnhancedSupervisoryFrameWithFcsView::Create(standard_frame_view);
     if (!s_frame_view.IsValid()) {
@@ -908,10 +934,16 @@
   return next;
 }
 
-void ErtmController::stage_for_reassembly(SegmentationAndReassembly sar,
+void ErtmController::stage_for_reassembly(SegmentationAndReassembly sar, uint16_t sdu_size,
                                           const packet::PacketView<kLittleEndian>& payload) {
   switch (sar) {
     case SegmentationAndReassembly::UNSEGMENTED:
+      if (sar_state_ != SegmentationAndReassembly::END) {
+        LOG_WARN("Received invalid SAR");
+        close_channel();
+        return;
+      }
+      // TODO: Enforce MTU
       enqueue_buffer_.Enqueue(std::make_unique<packet::PacketView<kLittleEndian>>(payload), handler_);
       break;
     case SegmentationAndReassembly::START:
@@ -920,8 +952,10 @@
         close_channel();
         return;
       }
+      // TODO: Enforce MTU
       sar_state_ = SegmentationAndReassembly::START;
       reassembly_stage_ = payload;
+      remaining_sdu_continuation_packet_size_ = sdu_size - payload.size();
       break;
     case SegmentationAndReassembly::CONTINUATION:
       if (sar_state_ == SegmentationAndReassembly::END) {
@@ -930,6 +964,7 @@
         return;
       }
       reassembly_stage_.AppendPacketView(payload);
+      remaining_sdu_continuation_packet_size_ -= payload.size();
       break;
     case SegmentationAndReassembly::END:
       if (sar_state_ == SegmentationAndReassembly::END) {
@@ -937,9 +972,17 @@
         close_channel();
         return;
       }
+      sar_state_ = SegmentationAndReassembly::END;
+      remaining_sdu_continuation_packet_size_ -= payload.size();
+      if (remaining_sdu_continuation_packet_size_ != 0) {
+        LOG_WARN("Received invalid END I-Frame");
+        reassembly_stage_ = PacketViewForReassembly(std::make_shared<std::vector<uint8_t>>());
+        remaining_sdu_continuation_packet_size_ = 0;
+        close_channel();
+        return;
+      }
       reassembly_stage_.AppendPacketView(payload);
       enqueue_buffer_.Enqueue(std::make_unique<packet::PacketView<kLittleEndian>>(reassembly_stage_), handler_);
-      sar_state_ = SegmentationAndReassembly::END;
       break;
   }
 }
diff --git a/gd/l2cap/internal/enhanced_retransmission_mode_channel_data_controller.h b/gd/l2cap/internal/enhanced_retransmission_mode_channel_data_controller.h
index 14deea3..dd1ca64 100644
--- a/gd/l2cap/internal/enhanced_retransmission_mode_channel_data_controller.h
+++ b/gd/l2cap/internal/enhanced_retransmission_mode_channel_data_controller.h
@@ -59,7 +59,19 @@
   os::Handler* handler_;
   std::queue<std::unique_ptr<packet::BasePacketBuilder>> pdu_queue_;
   Scheduler* scheduler_;
+
+  // Configuration options
   bool fcs_enabled_ = false;
+  uint16_t local_tx_window_ = 10;
+  uint16_t local_max_transmit_ = 20;
+  uint16_t local_retransmit_timeout_ms_ = 2000;
+  uint16_t local_monitor_timeout_ms_ = 12000;
+
+  uint16_t remote_tx_window_ = 10;
+  uint16_t remote_mps_ = 1010;
+
+  uint16_t size_each_packet_ =
+      (remote_mps_ - 4 /* basic L2CAP header */ - 2 /* SDU length */ - 2 /* Extended control */ - 2 /* FCS */);
 
   class PacketViewForReassembly : public packet::PacketView<kLittleEndian> {
    public:
@@ -83,8 +95,10 @@
 
   PacketViewForReassembly reassembly_stage_{std::make_shared<std::vector<uint8_t>>()};
   SegmentationAndReassembly sar_state_ = SegmentationAndReassembly::END;
+  uint16_t remaining_sdu_continuation_packet_size_ = 0;
 
-  void stage_for_reassembly(SegmentationAndReassembly sar, const packet::PacketView<kLittleEndian>& payload);
+  void stage_for_reassembly(SegmentationAndReassembly sar, uint16_t sdu_size,
+                            const packet::PacketView<kLittleEndian>& payload);
   void send_pdu(std::unique_ptr<packet::BasePacketBuilder> pdu);
 
   void close_channel();
@@ -92,18 +106,6 @@
   void on_pdu_no_fcs(const packet::PacketView<true>& pdu);
   void on_pdu_fcs(const packet::PacketView<true>& pdu);
 
-  // Configuration options
-  uint16_t local_tx_window_ = 10;
-  uint16_t local_max_transmit_ = 20;
-  uint16_t local_retransmit_timeout_ms_ = 2000;
-  uint16_t local_monitor_timeout_ms_ = 12000;
-
-  uint16_t remote_tx_window_ = 10;
-  uint16_t remote_mps_ = 1010;
-
-  uint16_t size_each_packet_ =
-      (remote_mps_ - 4 /* basic L2CAP header */ - 2 /* SDU length */ - 2 /* Extended control */ - 2 /* FCS */);
-
   struct impl;
   std::unique_ptr<impl> pimpl_;
 };
diff --git a/gd/l2cap/internal/enhanced_retransmission_mode_channel_data_controller_test.cc b/gd/l2cap/internal/enhanced_retransmission_mode_channel_data_controller_test.cc
index 04ef82b..e1b5818 100644
--- a/gd/l2cap/internal/enhanced_retransmission_mode_channel_data_controller_test.cc
+++ b/gd/l2cap/internal/enhanced_retransmission_mode_channel_data_controller_test.cc
@@ -108,6 +108,54 @@
   EXPECT_EQ(data, "abcd");
 }
 
+TEST_F(ErtmDataControllerTest, reassemble_valid_sdu) {
+  common::BidiQueue<Scheduler::UpperEnqueue, Scheduler::UpperDequeue> channel_queue{10};
+  testing::MockScheduler scheduler;
+  ErtmController controller{1, 1, channel_queue.GetDownEnd(), queue_handler_, &scheduler};
+  auto segment1 = CreateSdu({'a'});
+  auto segment2 = CreateSdu({'b', 'c'});
+  auto segment3 = CreateSdu({'d', 'e', 'f'});
+  auto builder1 = EnhancedInformationStartFrameBuilder::Create(1, 0, Final::NOT_SET, 0, 6, std::move(segment1));
+  auto base_view = GetPacketView(std::move(builder1));
+  controller.OnPdu(base_view);
+  auto builder2 = EnhancedInformationFrameBuilder::Create(1, 1, Final::NOT_SET, 0,
+                                                          SegmentationAndReassembly::CONTINUATION, std::move(segment2));
+  base_view = GetPacketView(std::move(builder2));
+  controller.OnPdu(base_view);
+  auto builder3 = EnhancedInformationFrameBuilder::Create(1, 2, Final::NOT_SET, 0, SegmentationAndReassembly::END,
+                                                          std::move(segment3));
+  base_view = GetPacketView(std::move(builder3));
+  controller.OnPdu(base_view);
+  sync_handler(queue_handler_);
+  auto payload = channel_queue.GetUpEnd()->TryDequeue();
+  EXPECT_NE(payload, nullptr);
+  std::string data = std::string(payload->begin(), payload->end());
+  EXPECT_EQ(data, "abcdef");
+}
+
+TEST_F(ErtmDataControllerTest, reassemble_invalid_sdu_size_in_start_frame) {
+  common::BidiQueue<Scheduler::UpperEnqueue, Scheduler::UpperDequeue> channel_queue{10};
+  testing::MockScheduler scheduler;
+  ErtmController controller{1, 1, channel_queue.GetDownEnd(), queue_handler_, &scheduler};
+  auto segment1 = CreateSdu({'a'});
+  auto segment2 = CreateSdu({'b', 'c'});
+  auto segment3 = CreateSdu({'d', 'e', 'f'});
+  auto builder1 = EnhancedInformationStartFrameBuilder::Create(1, 0, Final::NOT_SET, 0, 10, std::move(segment1));
+  auto base_view = GetPacketView(std::move(builder1));
+  controller.OnPdu(base_view);
+  auto builder2 = EnhancedInformationFrameBuilder::Create(1, 1, Final::NOT_SET, 0,
+                                                          SegmentationAndReassembly::CONTINUATION, std::move(segment2));
+  base_view = GetPacketView(std::move(builder2));
+  controller.OnPdu(base_view);
+  auto builder3 = EnhancedInformationFrameBuilder::Create(1, 2, Final::NOT_SET, 0, SegmentationAndReassembly::END,
+                                                          std::move(segment3));
+  base_view = GetPacketView(std::move(builder3));
+  controller.OnPdu(base_view);
+  sync_handler(queue_handler_);
+  auto payload = channel_queue.GetUpEnd()->TryDequeue();
+  EXPECT_EQ(payload, nullptr);
+}
+
 TEST_F(ErtmDataControllerTest, transmit_with_fcs) {
   common::BidiQueue<Scheduler::UpperEnqueue, Scheduler::UpperDequeue> channel_queue{10};
   testing::MockScheduler scheduler;
diff --git a/gd/l2cap/internal/fixed_channel_allocator_test.cc b/gd/l2cap/internal/fixed_channel_allocator_test.cc
index 2162d36..38eac13 100644
--- a/gd/l2cap/internal/fixed_channel_allocator_test.cc
+++ b/gd/l2cap/internal/fixed_channel_allocator_test.cc
@@ -31,7 +31,7 @@
 using testing::MockParameterProvider;
 using ::testing::Return;
 
-const hci::Address device{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}};
+const hci::AddressWithType device{{{0x01, 0x02, 0x03, 0x04, 0x05, 0x06}}, hci::AddressType::PUBLIC_IDENTITY_ADDRESS};
 
 class L2capFixedChannelAllocatorTest : public ::testing::Test {
  protected:
diff --git a/gd/l2cap/internal/ilink.h b/gd/l2cap/internal/ilink.h
new file mode 100644
index 0000000..4f0b6f6
--- /dev/null
+++ b/gd/l2cap/internal/ilink.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "hci/address_with_type.h"
+#include "l2cap/cid.h"
+
+namespace bluetooth {
+namespace l2cap {
+namespace internal {
+
+/**
+ * Common interface for link (Classic ACL and LE)
+ */
+class ILink {
+ public:
+  virtual void SendDisconnectionRequest(Cid local_cid, Cid remote_cid) = 0;
+  virtual ~ILink() = default;
+  virtual hci::AddressWithType GetDevice() = 0;
+};
+}  // namespace internal
+}  // namespace l2cap
+}  // namespace bluetooth
diff --git a/gd/l2cap/internal/le_credit_based_channel_data_controller.cc b/gd/l2cap/internal/le_credit_based_channel_data_controller.cc
new file mode 100644
index 0000000..eb510c1
--- /dev/null
+++ b/gd/l2cap/internal/le_credit_based_channel_data_controller.cc
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2019 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 "l2cap/internal/le_credit_based_channel_data_controller.h"
+
+#include "l2cap/l2cap_packets.h"
+#include "packet/fragmenting_inserter.h"
+#include "packet/raw_builder.h"
+
+namespace bluetooth {
+namespace l2cap {
+namespace internal {
+
+LeCreditBasedDataController::LeCreditBasedDataController(Cid cid, Cid remote_cid, UpperQueueDownEnd* channel_queue_end,
+                                                         os::Handler* handler, Scheduler* scheduler)
+    : cid_(cid), remote_cid_(remote_cid), enqueue_buffer_(channel_queue_end), handler_(handler), scheduler_(scheduler) {
+}
+
+void LeCreditBasedDataController::OnSdu(std::unique_ptr<packet::BasePacketBuilder> sdu) {
+  auto sdu_size = sdu->size();
+  if (sdu_size == 0) {
+    LOG_WARN("Received empty SDU");
+    return;
+  }
+  if (sdu_size > mtu_) {
+    LOG_WARN("Received sdu_size %d > mtu %d", static_cast<int>(sdu_size), mtu_);
+  }
+  std::vector<std::unique_ptr<packet::RawBuilder>> segments;
+  // TODO: We don't need to waste 2 bytes for continuation segment.
+  packet::FragmentingInserter fragmenting_inserter(mps_ - 2, std::back_insert_iterator(segments));
+  sdu->Serialize(fragmenting_inserter);
+  fragmenting_inserter.finalize();
+  std::unique_ptr<BasicFrameBuilder> builder;
+  builder = FirstLeInformationFrameBuilder::Create(remote_cid_, sdu_size, std::move(segments[0]));
+  pdu_queue_.emplace(std::move(builder));
+  for (auto i = 1; i < segments.size(); i++) {
+    builder = BasicFrameBuilder::Create(remote_cid_, std::move(segments[i]));
+    pdu_queue_.emplace(std::move(builder));
+  }
+  scheduler_->OnPacketsReady(cid_, segments.size());
+}
+
+void LeCreditBasedDataController::OnPdu(packet::PacketView<true> pdu) {
+  auto basic_frame_view = BasicFrameView::Create(pdu);
+  if (!basic_frame_view.IsValid()) {
+    LOG_WARN("Received invalid frame");
+    return;
+  }
+  if (basic_frame_view.size() > mps_) {
+    LOG_WARN("Received frame size %d > mps %d, dropping the packet", static_cast<int>(basic_frame_view.size()), mps_);
+    return;
+  }
+  if (remaining_sdu_continuation_packet_size_ == 0) {
+    auto start_frame_view = FirstLeInformationFrameView::Create(basic_frame_view);
+    if (!start_frame_view.IsValid()) {
+      LOG_WARN("Received invalid frame");
+      return;
+    }
+    auto payload = start_frame_view.GetPayload();
+    auto sdu_size = start_frame_view.GetL2capSduLength();
+    remaining_sdu_continuation_packet_size_ = sdu_size - payload.size();
+    reassembly_stage_ = payload;
+  } else {
+    auto payload = basic_frame_view.GetPayload();
+    remaining_sdu_continuation_packet_size_ -= payload.size();
+    reassembly_stage_.AppendPacketView(payload);
+  }
+  if (remaining_sdu_continuation_packet_size_ == 0) {
+    enqueue_buffer_.Enqueue(std::make_unique<PacketView<kLittleEndian>>(reassembly_stage_), handler_);
+  } else if (remaining_sdu_continuation_packet_size_ < 0 || reassembly_stage_.size() > mtu_) {
+    LOG_WARN("Received larger SDU size than expected");
+    reassembly_stage_ = PacketViewForReassembly(std::make_shared<std::vector<uint8_t>>());
+    remaining_sdu_continuation_packet_size_ = 0;
+    // TODO: Close channel
+  }
+}
+
+std::unique_ptr<packet::BasePacketBuilder> LeCreditBasedDataController::GetNextPacket() {
+  auto next = std::move(pdu_queue_.front());
+  pdu_queue_.pop();
+  return next;
+}
+
+void LeCreditBasedDataController::SetMtu(Mtu mtu) {
+  mtu_ = mtu;
+}
+
+void LeCreditBasedDataController::SetMps(uint16_t mps) {
+  mps_ = mps;
+}
+
+void LeCreditBasedDataController::OnCredit(uint16_t credits) {
+  int total_credits = credits_ + credits;
+  credits_ = total_credits > 0xffff ? 0xffff : total_credits;
+}
+
+}  // namespace internal
+}  // namespace l2cap
+}  // namespace bluetooth
diff --git a/gd/l2cap/internal/le_credit_based_channel_data_controller.h b/gd/l2cap/internal/le_credit_based_channel_data_controller.h
new file mode 100644
index 0000000..9374cd6
--- /dev/null
+++ b/gd/l2cap/internal/le_credit_based_channel_data_controller.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <memory>
+#include <unordered_map>
+#include <utility>
+
+#include "common/bidi_queue.h"
+#include "l2cap/cid.h"
+#include "l2cap/internal/channel_impl.h"
+#include "l2cap/internal/data_controller.h"
+#include "l2cap/internal/scheduler.h"
+#include "l2cap/l2cap_packets.h"
+#include "l2cap/mtu.h"
+#include "os/handler.h"
+#include "os/queue.h"
+#include "packet/base_packet_builder.h"
+#include "packet/packet_view.h"
+
+namespace bluetooth {
+namespace l2cap {
+namespace internal {
+
+class LeCreditBasedDataController : public DataController {
+ public:
+  using UpperEnqueue = packet::PacketView<packet::kLittleEndian>;
+  using UpperDequeue = packet::BasePacketBuilder;
+  using UpperQueueDownEnd = common::BidiQueueEnd<UpperEnqueue, UpperDequeue>;
+  LeCreditBasedDataController(Cid cid, Cid remote_cid, UpperQueueDownEnd* channel_queue_end, os::Handler* handler,
+                              Scheduler* scheduler);
+
+  void OnSdu(std::unique_ptr<packet::BasePacketBuilder> sdu) override;
+  void OnPdu(packet::PacketView<true> pdu) override;
+  std::unique_ptr<packet::BasePacketBuilder> GetNextPacket() override;
+
+  void EnableFcs(bool enabled) override {}
+  void SetRetransmissionAndFlowControlOptions(const RetransmissionAndFlowControlConfigurationOption& option) override {}
+
+  // TODO: Set MTU and MPS from signalling channel
+  void SetMtu(Mtu mtu);
+  void SetMps(uint16_t mps);
+  // TODO: Handle credits
+  void OnCredit(uint16_t credits);
+
+ private:
+  Cid cid_;
+  Cid remote_cid_;
+  os::EnqueueBuffer<UpperEnqueue> enqueue_buffer_;
+  os::Handler* handler_;
+  std::queue<std::unique_ptr<packet::BasePacketBuilder>> pdu_queue_;
+  Scheduler* scheduler_;
+  Mtu mtu_ = 512;
+  uint16_t mps_ = 251;
+  uint16_t credits_ = 0;
+
+  class PacketViewForReassembly : public packet::PacketView<kLittleEndian> {
+   public:
+    PacketViewForReassembly(const PacketView& packetView) : PacketView(packetView) {}
+    void AppendPacketView(packet::PacketView<kLittleEndian> to_append) {
+      Append(to_append);
+    }
+  };
+  PacketViewForReassembly reassembly_stage_{std::make_shared<std::vector<uint8_t>>()};
+  uint16_t remaining_sdu_continuation_packet_size_ = 0;
+};
+
+}  // namespace internal
+}  // namespace l2cap
+}  // namespace bluetooth
diff --git a/gd/l2cap/internal/le_credit_based_channel_data_controller_test.cc b/gd/l2cap/internal/le_credit_based_channel_data_controller_test.cc
new file mode 100644
index 0000000..071e976
--- /dev/null
+++ b/gd/l2cap/internal/le_credit_based_channel_data_controller_test.cc
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2019 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 "l2cap/internal/le_credit_based_channel_data_controller.h"
+
+#include <gtest/gtest.h>
+
+#include "l2cap/internal/scheduler_mock.h"
+#include "l2cap/l2cap_packets.h"
+#include "packet/raw_builder.h"
+
+namespace bluetooth {
+namespace l2cap {
+namespace internal {
+namespace {
+
+std::unique_ptr<packet::BasePacketBuilder> CreateSdu(std::vector<uint8_t> payload) {
+  auto raw_builder = std::make_unique<packet::RawBuilder>();
+  raw_builder->AddOctets(payload);
+  return raw_builder;
+}
+
+PacketView<kLittleEndian> GetPacketView(std::unique_ptr<packet::BasePacketBuilder> packet) {
+  auto bytes = std::make_shared<std::vector<uint8_t>>();
+  BitInserter i(*bytes);
+  bytes->reserve(packet->size());
+  packet->Serialize(i);
+  return packet::PacketView<packet::kLittleEndian>(bytes);
+}
+
+void sync_handler(os::Handler* handler) {
+  std::promise<void> promise;
+  auto future = promise.get_future();
+  handler->Post(common::BindOnce(&std::promise<void>::set_value, common::Unretained(&promise)));
+  auto status = future.wait_for(std::chrono::milliseconds(300));
+  EXPECT_EQ(status, std::future_status::ready);
+}
+
+class LeCreditBasedDataControllerTest : public ::testing::Test {
+ protected:
+  void SetUp() override {
+    thread_ = new os::Thread("test_thread", os::Thread::Priority::NORMAL);
+    user_handler_ = new os::Handler(thread_);
+    queue_handler_ = new os::Handler(thread_);
+  }
+
+  void TearDown() override {
+    queue_handler_->Clear();
+    user_handler_->Clear();
+    delete queue_handler_;
+    delete user_handler_;
+    delete thread_;
+  }
+
+  os::Thread* thread_ = nullptr;
+  os::Handler* user_handler_ = nullptr;
+  os::Handler* queue_handler_ = nullptr;
+};
+
+TEST_F(LeCreditBasedDataControllerTest, transmit_unsegmented) {
+  common::BidiQueue<Scheduler::UpperEnqueue, Scheduler::UpperDequeue> channel_queue{10};
+  testing::MockScheduler scheduler;
+  LeCreditBasedDataController controller{0x41, 0x41, channel_queue.GetDownEnd(), queue_handler_, &scheduler};
+  EXPECT_CALL(scheduler, OnPacketsReady(0x41, 1));
+  controller.OnSdu(CreateSdu({'a', 'b', 'c', 'd'}));
+  auto next_packet = controller.GetNextPacket();
+  EXPECT_NE(next_packet, nullptr);
+  auto view = GetPacketView(std::move(next_packet));
+  auto pdu_view = BasicFrameView::Create(view);
+  EXPECT_TRUE(pdu_view.IsValid());
+  auto first_le_info_view = FirstLeInformationFrameView::Create(pdu_view);
+  EXPECT_TRUE(first_le_info_view.IsValid());
+  auto payload = first_le_info_view.GetPayload();
+  std::string data = std::string(payload.begin(), payload.end());
+  EXPECT_EQ(data, "abcd");
+}
+
+TEST_F(LeCreditBasedDataControllerTest, transmit_segmented) {
+  common::BidiQueue<Scheduler::UpperEnqueue, Scheduler::UpperDequeue> channel_queue{10};
+  testing::MockScheduler scheduler;
+  LeCreditBasedDataController controller{0x41, 0x41, channel_queue.GetDownEnd(), queue_handler_, &scheduler};
+  controller.SetMps(4);
+  EXPECT_CALL(scheduler, OnPacketsReady(0x41, 2));
+  // Should be divided into 'ab', and 'cd'
+  controller.OnSdu(CreateSdu({'a', 'b', 'c', 'd'}));
+  auto next_packet = controller.GetNextPacket();
+  EXPECT_NE(next_packet, nullptr);
+  auto view = GetPacketView(std::move(next_packet));
+  auto pdu_view = BasicFrameView::Create(view);
+  EXPECT_TRUE(pdu_view.IsValid());
+  auto first_le_info_view = FirstLeInformationFrameView::Create(pdu_view);
+  EXPECT_TRUE(first_le_info_view.IsValid());
+  auto payload = first_le_info_view.GetPayload();
+  std::string data = std::string(payload.begin(), payload.end());
+  EXPECT_EQ(data, "ab");
+  EXPECT_EQ(first_le_info_view.GetL2capSduLength(), 4);
+
+  next_packet = controller.GetNextPacket();
+  EXPECT_NE(next_packet, nullptr);
+  view = GetPacketView(std::move(next_packet));
+  pdu_view = BasicFrameView::Create(view);
+  EXPECT_TRUE(pdu_view.IsValid());
+  payload = pdu_view.GetPayload();
+  data = std::string(payload.begin(), payload.end());
+  EXPECT_EQ(data, "cd");
+}
+
+TEST_F(LeCreditBasedDataControllerTest, receive_unsegmented) {
+  common::BidiQueue<Scheduler::UpperEnqueue, Scheduler::UpperDequeue> channel_queue{10};
+  testing::MockScheduler scheduler;
+  LeCreditBasedDataController controller{0x41, 0x41, channel_queue.GetDownEnd(), queue_handler_, &scheduler};
+  auto segment = CreateSdu({'a', 'b', 'c', 'd'});
+  auto builder = FirstLeInformationFrameBuilder::Create(0x41, 4, std::move(segment));
+  auto base_view = GetPacketView(std::move(builder));
+  controller.OnPdu(base_view);
+  sync_handler(queue_handler_);
+  auto payload = channel_queue.GetUpEnd()->TryDequeue();
+  EXPECT_NE(payload, nullptr);
+  std::string data = std::string(payload->begin(), payload->end());
+  EXPECT_EQ(data, "abcd");
+}
+
+TEST_F(LeCreditBasedDataControllerTest, receive_segmented) {
+  common::BidiQueue<Scheduler::UpperEnqueue, Scheduler::UpperDequeue> channel_queue{10};
+  testing::MockScheduler scheduler;
+  LeCreditBasedDataController controller{0x41, 0x41, channel_queue.GetDownEnd(), queue_handler_, &scheduler};
+  auto segment1 = CreateSdu({'a', 'b', 'c', 'd'});
+  auto builder1 = FirstLeInformationFrameBuilder::Create(0x41, 7, std::move(segment1));
+  auto base_view = GetPacketView(std::move(builder1));
+  controller.OnPdu(base_view);
+  auto segment2 = CreateSdu({'e', 'f', 'g'});
+  auto builder2 = BasicFrameBuilder::Create(0x41, std::move(segment2));
+  base_view = GetPacketView(std::move(builder2));
+  controller.OnPdu(base_view);
+  sync_handler(queue_handler_);
+  auto payload = channel_queue.GetUpEnd()->TryDequeue();
+  EXPECT_NE(payload, nullptr);
+  std::string data = std::string(payload->begin(), payload->end());
+  EXPECT_EQ(data, "abcdefg");
+}
+
+TEST_F(LeCreditBasedDataControllerTest, receive_segmented_with_wrong_sdu_length) {
+  common::BidiQueue<Scheduler::UpperEnqueue, Scheduler::UpperDequeue> channel_queue{10};
+  testing::MockScheduler scheduler;
+  LeCreditBasedDataController controller{0x41, 0x41, channel_queue.GetDownEnd(), queue_handler_, &scheduler};
+  auto segment1 = CreateSdu({'a', 'b', 'c', 'd'});
+  auto builder1 = FirstLeInformationFrameBuilder::Create(0x41, 5, std::move(segment1));
+  auto base_view = GetPacketView(std::move(builder1));
+  controller.OnPdu(base_view);
+  auto segment2 = CreateSdu({'e', 'f', 'g'});
+  auto builder2 = BasicFrameBuilder::Create(0x41, std::move(segment2));
+  base_view = GetPacketView(std::move(builder2));
+  controller.OnPdu(base_view);
+  sync_handler(queue_handler_);
+  auto payload = channel_queue.GetUpEnd()->TryDequeue();
+  EXPECT_EQ(payload, nullptr);
+}
+
+}  // namespace
+}  // namespace internal
+}  // namespace l2cap
+}  // namespace bluetooth
diff --git a/gd/l2cap/internal/receiver.cc b/gd/l2cap/internal/receiver.cc
index e92de0b..86f43ae 100644
--- a/gd/l2cap/internal/receiver.cc
+++ b/gd/l2cap/internal/receiver.cc
@@ -18,14 +18,16 @@
 
 #include "common/bidi_queue.h"
 #include "l2cap/cid.h"
+#include "l2cap/internal/data_pipeline_manager.h"
 #include "l2cap/l2cap_packets.h"
 #include "packet/packet_view.h"
 
 namespace bluetooth {
 namespace l2cap {
 namespace internal {
-Receiver::Receiver(LowerQueueUpEnd* link_queue_up_end, os::Handler* handler, Scheduler* scheduler)
-    : link_queue_up_end_(link_queue_up_end), handler_(handler), scheduler_(scheduler) {
+Receiver::Receiver(LowerQueueUpEnd* link_queue_up_end, os::Handler* handler,
+                   DataPipelineManager* data_pipeline_manager_)
+    : link_queue_up_end_(link_queue_up_end), handler_(handler), data_pipeline_manager_(data_pipeline_manager_) {
   ASSERT(link_queue_up_end_ != nullptr && handler_ != nullptr);
   link_queue_up_end_->RegisterDequeue(handler_,
                                       common::Bind(&Receiver::link_queue_dequeue_callback, common::Unretained(this)));
@@ -43,7 +45,7 @@
     return;
   }
   Cid cid = static_cast<Cid>(basic_frame_view.GetChannelId());
-  auto* data_controller = scheduler_->GetDataController(cid);
+  auto* data_controller = data_pipeline_manager_->GetDataController(cid);
   if (data_controller == nullptr) {
     LOG_WARN("Received a packet with invalid cid: %d", cid);
     return;
diff --git a/gd/l2cap/internal/receiver.h b/gd/l2cap/internal/receiver.h
index e3c035e..f757319 100644
--- a/gd/l2cap/internal/receiver.h
+++ b/gd/l2cap/internal/receiver.h
@@ -34,6 +34,8 @@
 namespace l2cap {
 namespace internal {
 
+class DataPipelineManager;
+
 /**
  * Handle receiving L2CAP PDUs from link queue and distribute them into into channel data controllers.
  * Dequeue incoming packets from LinkQueueUpEnd, and enqueue it to ChannelQueueDownEnd. Note: If a channel
@@ -51,13 +53,13 @@
   using LowerDequeue = UpperEnqueue;
   using LowerQueueUpEnd = common::BidiQueueEnd<LowerEnqueue, LowerDequeue>;
 
-  Receiver(LowerQueueUpEnd* link_queue_up_end, os::Handler* handler, Scheduler* scheduler);
+  Receiver(LowerQueueUpEnd* link_queue_up_end, os::Handler* handler, DataPipelineManager* data_pipeline_manager);
   ~Receiver();
 
  private:
   LowerQueueUpEnd* link_queue_up_end_;
   os::Handler* handler_;
-  Scheduler* scheduler_;
+  DataPipelineManager* data_pipeline_manager_;
 
   void link_queue_dequeue_callback();
 };
diff --git a/gd/l2cap/internal/scheduler.h b/gd/l2cap/internal/scheduler.h
index 59f2bfd..416c972 100644
--- a/gd/l2cap/internal/scheduler.h
+++ b/gd/l2cap/internal/scheduler.h
@@ -50,34 +50,10 @@
   using LowerQueueUpEnd = common::BidiQueueEnd<LowerEnqueue, LowerDequeue>;
 
   /**
-   * Attach the channel with the specified ChannelQueueDownEnd into the scheduler.
-   * Scheduler needs to notify the channel its Sender through SetSender().
-   *
-   * @param cid The channel to attach to the scheduler.
-   * @param channel The reference to a DynamicChannelImpl object. Use nullptr for fixed channel.
-   * TODO (b/144503952): Rethink about channel abstraction. Currently channel contains duplicated info as remote_cid
-   */
-  virtual void AttachChannel(Cid cid, std::shared_ptr<ChannelImpl> channel) {}
-
-  /**
-   * Detach the channel from the scheduler.
-   *
-   * @param cid The channel to detach to the scheduler.
-   */
-  virtual void DetachChannel(Cid cid) {}
-
-  /**
    * Callback from the sender to indicate that the scheduler could dequeue number_packets from it
    */
   virtual void OnPacketsReady(Cid cid, int number_packets) {}
 
-  /**
-   * Get the data controller for Reassembler
-   */
-  virtual DataController* GetDataController(Cid cid) {
-    return nullptr;
-  }
-
   virtual ~Scheduler() = default;
 };
 
diff --git a/gd/l2cap/internal/scheduler_fifo.cc b/gd/l2cap/internal/scheduler_fifo.cc
index 7454cbe..a19b7a1 100644
--- a/gd/l2cap/internal/scheduler_fifo.cc
+++ b/gd/l2cap/internal/scheduler_fifo.cc
@@ -16,7 +16,8 @@
 
 #include "l2cap/internal/scheduler_fifo.h"
 
-#include "l2cap/classic/internal/dynamic_channel_impl.h"
+#include "dynamic_channel_impl.h"
+#include "l2cap/internal/data_pipeline_manager.h"
 #include "l2cap/l2cap_packets.h"
 #include "os/log.h"
 
@@ -24,32 +25,17 @@
 namespace l2cap {
 namespace internal {
 
-Fifo::Fifo(LowerQueueUpEnd* link_queue_up_end, os::Handler* handler)
-    : link_queue_up_end_(link_queue_up_end), handler_(handler) {
+Fifo::Fifo(DataPipelineManager* data_pipeline_manager, LowerQueueUpEnd* link_queue_up_end, os::Handler* handler)
+    : data_pipeline_manager_(data_pipeline_manager), link_queue_up_end_(link_queue_up_end), handler_(handler) {
   ASSERT(link_queue_up_end_ != nullptr && handler_ != nullptr);
 }
 
 Fifo::~Fifo() {
-  sender_map_.clear();
   if (link_queue_enqueue_registered_) {
     link_queue_up_end_->UnregisterEnqueue();
   }
 }
 
-void Fifo::AttachChannel(Cid cid, std::shared_ptr<ChannelImpl> channel) {
-  ASSERT(sender_map_.find(cid) == sender_map_.end());
-  sender_map_.emplace(std::piecewise_construct, std::forward_as_tuple(cid),
-                      std::forward_as_tuple(handler_, this, channel));
-  if (channel->GetCid() >= kFirstDynamicChannel) {
-    channel->SetSender(&sender_map_.find(cid)->second);
-  }
-}
-
-void Fifo::DetachChannel(Cid cid) {
-  ASSERT(sender_map_.find(cid) != sender_map_.end());
-  sender_map_.erase(cid);
-}
-
 void Fifo::OnPacketsReady(Cid cid, int number_packets) {
   next_to_dequeue_and_num_packets.push(std::make_pair(cid, number_packets));
   try_register_link_queue_enqueue();
@@ -63,9 +49,9 @@
   if (channel_id_and_number_packets.second == 0) {
     next_to_dequeue_and_num_packets.pop();
   }
-  auto packet = sender_map_.find(channel_id)->second.GetNextPacket();
+  auto packet = data_pipeline_manager_->GetDataController(channel_id)->GetNextPacket();
 
-  sender_map_.find(channel_id)->second.OnPacketSent();
+  data_pipeline_manager_->OnPacketSent(channel_id);
   if (next_to_dequeue_and_num_packets.empty()) {
     link_queue_up_end_->UnregisterEnqueue();
     link_queue_enqueue_registered_ = false;
@@ -82,13 +68,6 @@
   link_queue_enqueue_registered_ = true;
 }
 
-DataController* Fifo::GetDataController(Cid cid) {
-  if (sender_map_.find(cid) == sender_map_.end()) {
-    return nullptr;
-  }
-  return sender_map_.find(cid)->second.GetDataController();
-}
-
 }  // namespace internal
 }  // namespace l2cap
 }  // namespace bluetooth
diff --git a/gd/l2cap/internal/scheduler_fifo.h b/gd/l2cap/internal/scheduler_fifo.h
index b20ea4f..f6fcf7f 100644
--- a/gd/l2cap/internal/scheduler_fifo.h
+++ b/gd/l2cap/internal/scheduler_fifo.h
@@ -31,23 +31,21 @@
 namespace bluetooth {
 namespace l2cap {
 namespace internal {
+class DataPipelineManager;
 
 class Fifo : public Scheduler {
  public:
-  Fifo(LowerQueueUpEnd* link_queue_up_end, os::Handler* handler);
+  Fifo(DataPipelineManager* data_pipeline_manager, LowerQueueUpEnd* link_queue_up_end, os::Handler* handler);
   ~Fifo() override;
-  void AttachChannel(Cid cid, std::shared_ptr<ChannelImpl> channel) override;
-  void DetachChannel(Cid cid) override;
   void OnPacketsReady(Cid cid, int number_packets) override;
-  DataController* GetDataController(Cid cid) override;
 
  private:
+  DataPipelineManager* data_pipeline_manager_;
   LowerQueueUpEnd* link_queue_up_end_;
   os::Handler* handler_;
-  std::unordered_map<Cid, Sender> sender_map_;
   std::queue<std::pair<Cid, int>> next_to_dequeue_and_num_packets;
-
   bool link_queue_enqueue_registered_ = false;
+
   void try_register_link_queue_enqueue();
   std::unique_ptr<LowerEnqueue> link_queue_enqueue_callback();
 };
diff --git a/gd/l2cap/internal/scheduler_fifo_test.cc b/gd/l2cap/internal/scheduler_fifo_test.cc
index ff78838..cafd3b6 100644
--- a/gd/l2cap/internal/scheduler_fifo_test.cc
+++ b/gd/l2cap/internal/scheduler_fifo_test.cc
@@ -21,6 +21,8 @@
 #include <future>
 
 #include "l2cap/internal/channel_impl_mock.h"
+#include "l2cap/internal/data_controller_mock.h"
+#include "l2cap/internal/data_pipeline_manager_mock.h"
 #include "os/handler.h"
 #include "os/queue.h"
 #include "os/thread.h"
@@ -31,8 +33,23 @@
 namespace internal {
 namespace {
 
+using ::testing::_;
 using ::testing::Return;
 
+std::unique_ptr<packet::BasePacketBuilder> CreateSdu(std::vector<uint8_t> payload) {
+  auto raw_builder = std::make_unique<packet::RawBuilder>();
+  raw_builder->AddOctets(payload);
+  return raw_builder;
+}
+
+PacketView<kLittleEndian> GetPacketView(std::unique_ptr<packet::BasePacketBuilder> packet) {
+  auto bytes = std::make_shared<std::vector<uint8_t>>();
+  BitInserter i(*bytes);
+  bytes->reserve(packet->size());
+  packet->Serialize(i);
+  return packet::PacketView<packet::kLittleEndian>(bytes);
+}
+
 void sync_handler(os::Handler* handler) {
   std::promise<void> promise;
   auto future = promise.get_future();
@@ -41,17 +58,28 @@
   EXPECT_EQ(status, std::future_status::ready);
 }
 
+class MyDataController : public testing::MockDataController {
+ public:
+  std::unique_ptr<BasePacketBuilder> GetNextPacket() override {
+    return std::move(next_packet);
+  }
+
+  std::unique_ptr<BasePacketBuilder> next_packet;
+};
+
 class L2capSchedulerFifoTest : public ::testing::Test {
  protected:
   void SetUp() override {
     thread_ = new os::Thread("test_thread", os::Thread::Priority::NORMAL);
     user_handler_ = new os::Handler(thread_);
     queue_handler_ = new os::Handler(thread_);
-    fifo_ = new Fifo(link_queue_.GetUpEnd(), queue_handler_);
+    mock_data_pipeline_manager_ = new testing::MockDataPipelineManager(queue_handler_, link_queue_.GetUpEnd());
+    fifo_ = new Fifo(mock_data_pipeline_manager_, link_queue_.GetUpEnd(), queue_handler_);
   }
 
   void TearDown() override {
     delete fifo_;
+    delete mock_data_pipeline_manager_;
     queue_handler_->Clear();
     user_handler_->Clear();
     delete queue_handler_;
@@ -63,42 +91,26 @@
   os::Handler* user_handler_ = nullptr;
   os::Handler* queue_handler_ = nullptr;
   common::BidiQueue<Scheduler::LowerDequeue, Scheduler::LowerEnqueue> link_queue_{10};
+  testing::MockDataPipelineManager* mock_data_pipeline_manager_ = nullptr;
+  MyDataController data_controller_;
   Fifo* fifo_ = nullptr;
 };
 
 TEST_F(L2capSchedulerFifoTest, send_packet) {
-  common::BidiQueue<Scheduler::UpperEnqueue, Scheduler::UpperDequeue> channel_one_queue_{10};
-  common::BidiQueue<Scheduler::UpperEnqueue, Scheduler::UpperDequeue> channel_two_queue_{10};
-
-  auto mock_channel_1 = std::make_shared<testing::MockChannelImpl>();
-  EXPECT_CALL(*mock_channel_1, GetQueueDownEnd()).WillRepeatedly(Return(channel_one_queue_.GetDownEnd()));
-  EXPECT_CALL(*mock_channel_1, GetCid()).WillRepeatedly(Return(1));
-  EXPECT_CALL(*mock_channel_1, GetRemoteCid()).WillRepeatedly(Return(1));
-  auto mock_channel_2 = std::make_shared<testing::MockChannelImpl>();
-  EXPECT_CALL(*mock_channel_2, GetQueueDownEnd()).WillRepeatedly(Return(channel_two_queue_.GetDownEnd()));
-  EXPECT_CALL(*mock_channel_2, GetCid()).WillRepeatedly(Return(2));
-  EXPECT_CALL(*mock_channel_2, GetRemoteCid()).WillRepeatedly(Return(2));
-  fifo_->AttachChannel(1, mock_channel_1);
-  fifo_->AttachChannel(2, mock_channel_2);
-  os::EnqueueBuffer<Scheduler::UpperDequeue> channel_one_enqueue_buffer{channel_one_queue_.GetUpEnd()};
-  os::EnqueueBuffer<Scheduler::UpperDequeue> channel_two_enqueue_buffer{channel_two_queue_.GetUpEnd()};
-  auto packet_one = std::make_unique<packet::RawBuilder>();
-  packet_one->AddOctets({1, 2, 3});
-  auto packet_two = std::make_unique<packet::RawBuilder>();
-  packet_two->AddOctets({4, 5, 6, 7});
-  channel_one_enqueue_buffer.Enqueue(std::move(packet_one), user_handler_);
-  channel_two_enqueue_buffer.Enqueue(std::move(packet_two), user_handler_);
-  sync_handler(user_handler_);
+  auto frame = BasicFrameBuilder::Create(1, CreateSdu({'a', 'b', 'c'}));
+  data_controller_.next_packet = std::move(frame);
+  EXPECT_CALL(*mock_data_pipeline_manager_, GetDataController(_)).WillOnce(Return(&data_controller_));
+  EXPECT_CALL(*mock_data_pipeline_manager_, OnPacketSent(1));
+  fifo_->OnPacketsReady(1, 1);
   sync_handler(queue_handler_);
   sync_handler(user_handler_);
   auto packet = link_queue_.GetDownEnd()->TryDequeue();
-  EXPECT_NE(packet, nullptr);
-  EXPECT_EQ(packet->size(), 7);
-  packet = link_queue_.GetDownEnd()->TryDequeue();
-  EXPECT_NE(packet, nullptr);
-  EXPECT_EQ(packet->size(), 8);
-  fifo_->DetachChannel(1);
-  fifo_->DetachChannel(2);
+  auto packet_view = GetPacketView(std::move(packet));
+  auto basic_frame_view = BasicFrameView::Create(packet_view);
+  EXPECT_TRUE(basic_frame_view.IsValid());
+  EXPECT_EQ(basic_frame_view.GetChannelId(), 1);
+  auto payload = basic_frame_view.GetPayload();
+  EXPECT_EQ(std::string(payload.begin(), payload.end()), "abc");
 }
 
 }  // namespace
diff --git a/gd/l2cap/internal/scheduler_mock.h b/gd/l2cap/internal/scheduler_mock.h
index 5fdffbe..c0ac4d7 100644
--- a/gd/l2cap/internal/scheduler_mock.h
+++ b/gd/l2cap/internal/scheduler_mock.h
@@ -28,8 +28,6 @@
 
 class MockScheduler : public Scheduler {
  public:
-  MOCK_METHOD(void, AttachChannel, (Cid cid, std::shared_ptr<l2cap::internal::ChannelImpl> channel), (override));
-  MOCK_METHOD(void, DetachChannel, (Cid cid), (override));
   MOCK_METHOD(void, OnPacketsReady, (Cid cid, int number_packet), (override));
 };
 
diff --git a/gd/l2cap/internal/sender.cc b/gd/l2cap/internal/sender.cc
index 7fe1dd7..1c146cf 100644
--- a/gd/l2cap/internal/sender.cc
+++ b/gd/l2cap/internal/sender.cc
@@ -14,20 +14,15 @@
  * limitations under the License.
  */
 
-#include <string>
 #include <unordered_map>
 
 #include "common/bind.h"
-#include "l2cap/cid.h"
-#include "l2cap/classic/internal/dynamic_channel_impl.h"
 #include "l2cap/internal/basic_mode_channel_data_controller.h"
 #include "l2cap/internal/enhanced_retransmission_mode_channel_data_controller.h"
 #include "l2cap/internal/scheduler.h"
 #include "l2cap/internal/sender.h"
 #include "os/handler.h"
 #include "os/log.h"
-#include "os/queue.h"
-#include "packet/base_packet_builder.h"
 
 namespace bluetooth {
 namespace l2cap {
@@ -55,32 +50,6 @@
   return data_controller_->GetNextPacket();
 }
 
-void Sender::SetChannelRetransmissionFlowControlMode(const RetransmissionAndFlowControlConfigurationOption& option) {
-  if (mode_ == option.mode_) {
-    return;
-  }
-  if (option.mode_ == RetransmissionAndFlowControlModeOption::L2CAP_BASIC) {
-    data_controller_ =
-        std::make_unique<BasicModeDataController>(channel_id_, remote_channel_id_, queue_end_, handler_, scheduler_);
-    return;
-  }
-  if (option.mode_ == RetransmissionAndFlowControlModeOption::ENHANCED_RETRANSMISSION) {
-    data_controller_ =
-        std::make_unique<ErtmController>(channel_id_, remote_channel_id_, queue_end_, handler_, scheduler_);
-    data_controller_->SetRetransmissionAndFlowControlOptions(option);
-    return;
-  }
-}
-
-void Sender::SetFcsType(FcsType fcs_type) {
-  // TODO: FCS is enabled when "not both side explicitly disable it".
-  data_controller_->EnableFcs(fcs_type == FcsType::DEFAULT);
-}
-
-void Sender::SetIncomingMtu(Mtu mtu) {
-  // TODO: Enforce MTU
-}
-
 DataController* Sender::GetDataController() {
   return data_controller_.get();
 }
@@ -101,6 +70,25 @@
   is_dequeue_registered_ = false;
 }
 
+void Sender::UpdateClassicConfiguration(classic::internal::ChannelConfigurationState config) {
+  auto mode = config.retransmission_and_flow_control_mode_;
+  if (mode == mode_) {
+    return;
+  }
+  if (mode == RetransmissionAndFlowControlModeOption::L2CAP_BASIC) {
+    data_controller_ =
+        std::make_unique<BasicModeDataController>(channel_id_, remote_channel_id_, queue_end_, handler_, scheduler_);
+    return;
+  }
+  if (mode == RetransmissionAndFlowControlModeOption::ENHANCED_RETRANSMISSION) {
+    data_controller_ =
+        std::make_unique<ErtmController>(channel_id_, remote_channel_id_, queue_end_, handler_, scheduler_);
+    data_controller_->SetRetransmissionAndFlowControlOptions(config.local_retransmission_and_flow_control_);
+    data_controller_->EnableFcs(config.fcs_type_ == FcsType::DEFAULT);
+    return;
+  }
+}
+
 }  // namespace internal
 }  // namespace l2cap
 }  // namespace bluetooth
diff --git a/gd/l2cap/internal/sender.h b/gd/l2cap/internal/sender.h
index 850a88d..46e0006 100644
--- a/gd/l2cap/internal/sender.h
+++ b/gd/l2cap/internal/sender.h
@@ -23,6 +23,7 @@
 #include "common/bind.h"
 #include "data_controller.h"
 #include "l2cap/cid.h"
+#include "l2cap/classic/internal/channel_configuration_state.h"
 #include "l2cap/internal/channel_impl.h"
 #include "l2cap/internal/data_controller.h"
 #include "l2cap/l2cap_packets.h"
@@ -61,10 +62,7 @@
    */
   std::unique_ptr<UpperDequeue> GetNextPacket();
 
-  void SetChannelRetransmissionFlowControlMode(const RetransmissionAndFlowControlConfigurationOption& option);
-  void SetFcsType(FcsType fcs_type);
-  void SetIncomingMtu(Mtu mtu);
-
+  void UpdateClassicConfiguration(classic::internal::ChannelConfigurationState config);
   DataController* GetDataController();
 
  private:
diff --git a/gd/l2cap/internal/sender_test.cc b/gd/l2cap/internal/sender_test.cc
index cb16245..cecdfa4 100644
--- a/gd/l2cap/internal/sender_test.cc
+++ b/gd/l2cap/internal/sender_test.cc
@@ -40,6 +40,14 @@
   return raw_builder;
 }
 
+PacketView<kLittleEndian> GetPacketView(std::unique_ptr<packet::BasePacketBuilder> packet) {
+  auto bytes = std::make_shared<std::vector<uint8_t>>();
+  BitInserter i(*bytes);
+  bytes->reserve(packet->size());
+  packet->Serialize(i);
+  return packet::PacketView<packet::kLittleEndian>(bytes);
+}
+
 class FakeScheduler : public Scheduler {
  public:
   void OnPacketsReady(Cid cid, int number_packets) override {
@@ -52,10 +60,10 @@
   std::function<void(Cid cid, int number_packets)> on_packets_ready_;
 };
 
-class L2capSegmenterTest : public ::testing::Test {
+class L2capSenderTest : public ::testing::Test {
  public:
   std::unique_ptr<Sender::UpperDequeue> enqueue_callback() {
-    auto packet_one = CreateSdu({1, 2, 3});
+    auto packet_one = CreateSdu({'a', 'b', 'c'});
     channel_queue_.GetUpEnd()->UnregisterEnqueue();
     return packet_one;
   }
@@ -67,15 +75,15 @@
     queue_handler_ = new os::Handler(thread_);
     mock_channel_ = std::make_shared<testing::MockChannelImpl>();
     EXPECT_CALL(*mock_channel_, GetQueueDownEnd()).WillRepeatedly(Return(channel_queue_.GetDownEnd()));
-    EXPECT_CALL(*mock_channel_, GetCid()).WillRepeatedly(Return(0x41));
-    EXPECT_CALL(*mock_channel_, GetRemoteCid()).WillRepeatedly(Return(0x41));
+    EXPECT_CALL(*mock_channel_, GetCid()).WillRepeatedly(Return(cid_));
+    EXPECT_CALL(*mock_channel_, GetRemoteCid()).WillRepeatedly(Return(cid_));
     sender_ = new Sender(queue_handler_, &scheduler_, mock_channel_);
   }
 
   void TearDown() override {
-    delete sender_;
     queue_handler_->Clear();
     user_handler_->Clear();
+    delete sender_;
     delete queue_handler_;
     delete user_handler_;
     delete thread_;
@@ -87,20 +95,27 @@
   common::BidiQueue<Sender::UpperEnqueue, Sender::UpperDequeue> channel_queue_{10};
   std::shared_ptr<testing::MockChannelImpl> mock_channel_;
   Sender* sender_ = nullptr;
+  Cid cid_ = 0x41;
   FakeScheduler scheduler_;
 };
 
-TEST_F(L2capSegmenterTest, send_packet) {
-  auto packet_one = CreateSdu({1, 2, 3});
+TEST_F(L2capSenderTest, send_packet) {
   std::promise<void> promise;
   auto future = promise.get_future();
   scheduler_.SetOnPacketsReady([&promise](Cid cid, int number_packets) { promise.set_value(); });
   channel_queue_.GetUpEnd()->RegisterEnqueue(
-      queue_handler_, common::Bind(&L2capSegmenterTest::enqueue_callback, common::Unretained(this)));
+      queue_handler_, common::Bind(&L2capSenderTest::enqueue_callback, common::Unretained(this)));
   auto status = future.wait_for(std::chrono::milliseconds(3));
   EXPECT_EQ(status, std::future_status::ready);
   auto packet = sender_->GetNextPacket();
   EXPECT_NE(packet, nullptr);
+  auto packet_view = GetPacketView(std::move(packet));
+  auto basic_frame_view = BasicFrameView::Create(packet_view);
+  EXPECT_TRUE(basic_frame_view.IsValid());
+  EXPECT_EQ(basic_frame_view.GetChannelId(), cid_);
+  auto payload = basic_frame_view.GetPayload();
+  std::string payload_string(payload.begin(), payload.end());
+  EXPECT_EQ(payload_string, "abc");
 }
 
 }  // namespace
diff --git a/gd/l2cap/le/internal/fixed_channel_impl.cc b/gd/l2cap/le/internal/fixed_channel_impl.cc
index 9ae4e1f..e09b80d 100644
--- a/gd/l2cap/le/internal/fixed_channel_impl.cc
+++ b/gd/l2cap/le/internal/fixed_channel_impl.cc
@@ -107,10 +107,6 @@
   return cid_;
 }
 
-void FixedChannelImpl::SetSender(l2cap::internal::Sender* sender) {
-  ASSERT_LOG(false, "Should not set sender for fixed channel");
-}
-
 }  // namespace internal
 }  // namespace le
 }  // namespace l2cap
diff --git a/gd/l2cap/le/internal/fixed_channel_impl.h b/gd/l2cap/le/internal/fixed_channel_impl.h
index 82a4125..5d6a11d 100644
--- a/gd/l2cap/le/internal/fixed_channel_impl.h
+++ b/gd/l2cap/le/internal/fixed_channel_impl.h
@@ -55,7 +55,6 @@
 
   Cid GetCid() const override;
   Cid GetRemoteCid() const override;
-  void SetSender(l2cap::internal::Sender* sender) override;
   virtual void OnClosed(hci::ErrorCode status);
 
   virtual std::string ToString() {
diff --git a/gd/l2cap/le/internal/link.h b/gd/l2cap/le/internal/link.h
index 783e03b..2807353 100644
--- a/gd/l2cap/le/internal/link.h
+++ b/gd/l2cap/le/internal/link.h
@@ -20,9 +20,10 @@
 #include <memory>
 
 #include "hci/acl_manager.h"
+#include "l2cap/internal/data_pipeline_manager.h"
 #include "l2cap/internal/fixed_channel_allocator.h"
+#include "l2cap/internal/ilink.h"
 #include "l2cap/internal/parameter_provider.h"
-#include "l2cap/internal/scheduler.h"
 #include "l2cap/le/internal/fixed_channel_impl.h"
 #include "os/alarm.h"
 
@@ -31,15 +32,15 @@
 namespace le {
 namespace internal {
 
-class Link {
+class Link : public l2cap::internal::ILink {
  public:
   Link(os::Handler* l2cap_handler, std::unique_ptr<hci::AclConnection> acl_connection,
-       std::unique_ptr<l2cap::internal::Scheduler> scheduler, l2cap::internal::ParameterProvider* parameter_provider)
-      : l2cap_handler_(l2cap_handler), acl_connection_(std::move(acl_connection)), scheduler_(std::move(scheduler)),
+       l2cap::internal::ParameterProvider* parameter_provider)
+      : l2cap_handler_(l2cap_handler), acl_connection_(std::move(acl_connection)),
+        data_pipeline_manager_(l2cap_handler, acl_connection_->GetAclQueueEnd()),
         parameter_provider_(parameter_provider) {
     ASSERT(l2cap_handler_ != nullptr);
     ASSERT(acl_connection_ != nullptr);
-    ASSERT(scheduler_ != nullptr);
     ASSERT(parameter_provider_ != nullptr);
     link_idle_disconnect_alarm_.Schedule(common::BindOnce(&Link::Disconnect, common::Unretained(this)),
                                          parameter_provider_->GetLeLinkIdleDisconnectTimeout());
@@ -69,7 +70,7 @@
 
   virtual std::shared_ptr<FixedChannelImpl> AllocateFixedChannel(Cid cid, SecurityPolicy security_policy) {
     auto channel = fixed_channel_allocator_.AllocateChannel(cid, security_policy);
-    scheduler_->AttachChannel(cid, channel);
+    data_pipeline_manager_.AttachChannel(cid, channel);
     return channel;
   }
 
@@ -94,11 +95,13 @@
     return GetDevice().ToString();
   }
 
+  void SendDisconnectionRequest(Cid local_cid, Cid remote_cid) override {}
+
  private:
   os::Handler* l2cap_handler_;
   l2cap::internal::FixedChannelAllocator<FixedChannelImpl, Link> fixed_channel_allocator_{this, l2cap_handler_};
   std::unique_ptr<hci::AclConnection> acl_connection_;
-  std::unique_ptr<l2cap::internal::Scheduler> scheduler_;
+  l2cap::internal::DataPipelineManager data_pipeline_manager_;
   l2cap::internal::ParameterProvider* parameter_provider_;
   os::Alarm link_idle_disconnect_alarm_{l2cap_handler_};
   DISALLOW_COPY_AND_ASSIGN(Link);
diff --git a/gd/l2cap/le/internal/link_manager.cc b/gd/l2cap/le/internal/link_manager.cc
index 989cf3d..fac8cbc 100644
--- a/gd/l2cap/le/internal/link_manager.cc
+++ b/gd/l2cap/le/internal/link_manager.cc
@@ -95,13 +95,11 @@
   hci::AddressWithType connected_address_with_type(acl_connection->GetAddress(), acl_connection->GetAddressType());
   ASSERT_LOG(GetLink(connected_address_with_type) == nullptr, "%s is connected twice without disconnection",
              acl_connection->GetAddress().ToString().c_str());
-  auto* link_queue_up_end = acl_connection->GetAclQueueEnd();
   // Register ACL disconnection callback in LinkManager so that we can clean up link resource properly
   acl_connection->RegisterDisconnectCallback(
       common::BindOnce(&LinkManager::OnDisconnect, common::Unretained(this), connected_address_with_type),
       l2cap_handler_);
-  links_.try_emplace(connected_address_with_type, l2cap_handler_, std::move(acl_connection),
-                     std::make_unique<l2cap::internal::Fifo>(link_queue_up_end, l2cap_handler_), parameter_provider_);
+  links_.try_emplace(connected_address_with_type, l2cap_handler_, std::move(acl_connection), parameter_provider_);
   auto* link = GetLink(connected_address_with_type);
   // Allocate and distribute channels for all registered fixed channel services
   auto fixed_channel_services = service_manager_->GetRegisteredServices();
diff --git a/gd/l2cap/le/internal/link_mock.h b/gd/l2cap/le/internal/link_mock.h
index 08ea629..5d537b3 100644
--- a/gd/l2cap/le/internal/link_mock.h
+++ b/gd/l2cap/le/internal/link_mock.h
@@ -34,8 +34,7 @@
 class MockLink : public Link {
  public:
   explicit MockLink(os::Handler* handler, l2cap::internal::ParameterProvider* parameter_provider)
-      : Link(handler, std::make_unique<MockAclConnection>(),
-             std::make_unique<l2cap::internal::testing::MockScheduler>(), parameter_provider){};
+      : Link(handler, std::make_unique<MockAclConnection>(), parameter_provider){};
   MOCK_METHOD(hci::AddressWithType, GetDevice, (), (override));
   MOCK_METHOD(hci::Role, GetRole, (), (override));
   MOCK_METHOD(void, OnAclDisconnected, (hci::ErrorCode status), (override));
diff --git a/gd/packet/fragmenting_inserter_unittest.cc b/gd/packet/fragmenting_inserter_unittest.cc
index 6179959..c2f1124 100644
--- a/gd/packet/fragmenting_inserter_unittest.cc
+++ b/gd/packet/fragmenting_inserter_unittest.cc
@@ -91,6 +91,36 @@
   ASSERT_EQ(checksum, observer.GetValue());
 }
 
+TEST(FragmentingInserterTest, testMtuBoundaries) {
+  constexpr size_t kPacketSize = 1024;
+  auto counts = RawBuilder();
+  for (size_t i = 0; i < kPacketSize; i++) {
+    counts.AddOctets1(static_cast<uint8_t>(i));
+  }
+
+  std::vector<std::unique_ptr<RawBuilder>> fragments_mtu_is_kPacketSize;
+  FragmentingInserter it(kPacketSize, std::back_insert_iterator(fragments_mtu_is_kPacketSize));
+  counts.Serialize(it);
+  it.finalize();
+  ASSERT_EQ(1, fragments_mtu_is_kPacketSize.size());
+  ASSERT_EQ(kPacketSize, fragments_mtu_is_kPacketSize[0]->size());
+
+  std::vector<std::unique_ptr<RawBuilder>> fragments_mtu_is_less;
+  FragmentingInserter it_less(kPacketSize - 1, std::back_insert_iterator(fragments_mtu_is_less));
+  counts.Serialize(it_less);
+  it_less.finalize();
+  ASSERT_EQ(2, fragments_mtu_is_less.size());
+  ASSERT_EQ(kPacketSize - 1, fragments_mtu_is_less[0]->size());
+  ASSERT_EQ(1, fragments_mtu_is_less[1]->size());
+
+  std::vector<std::unique_ptr<RawBuilder>> fragments_mtu_is_more;
+  FragmentingInserter it_more(kPacketSize + 1, std::back_insert_iterator(fragments_mtu_is_more));
+  counts.Serialize(it_more);
+  it_more.finalize();
+  ASSERT_EQ(1, fragments_mtu_is_more.size());
+  ASSERT_EQ(kPacketSize, fragments_mtu_is_more[0]->size());
+}
+
 constexpr size_t kPacketSize = 128;
 class FragmentingTest : public ::testing::TestWithParam<size_t> {
  public:
diff --git a/gd/packet/parser/fields/custom_field_fixed_size.cc b/gd/packet/parser/fields/custom_field_fixed_size.cc
index 029f0aa..687d48d 100644
--- a/gd/packet/parser/fields/custom_field_fixed_size.cc
+++ b/gd/packet/parser/fields/custom_field_fixed_size.cc
@@ -55,6 +55,10 @@
   // Do nothing.
 }
 
+void CustomFieldFixedSize::GenInserter(std::ostream& s) const {
+  s << "insert(" << GetName() << "_, i);";
+}
+
 void CustomFieldFixedSize::GenValidator(std::ostream&) const {
   // Do nothing.
 }
diff --git a/gd/packet/parser/fields/custom_field_fixed_size.h b/gd/packet/parser/fields/custom_field_fixed_size.h
index bd19eb0..97acff9 100644
--- a/gd/packet/parser/fields/custom_field_fixed_size.h
+++ b/gd/packet/parser/fields/custom_field_fixed_size.h
@@ -37,6 +37,8 @@
 
   virtual void GenParameterValidator(std::ostream&) const override;
 
+  virtual void GenInserter(std::ostream& s) const override;
+
   virtual void GenValidator(std::ostream&) const override;
 
   std::string type_name_;
diff --git a/gd/packet/parser/fields/scalar_field.cc b/gd/packet/parser/fields/scalar_field.cc
index c6d2ecf..320534a 100644
--- a/gd/packet/parser/fields/scalar_field.cc
+++ b/gd/packet/parser/fields/scalar_field.cc
@@ -121,8 +121,6 @@
 void ScalarField::GenInserter(std::ostream& s) const {
   if (GetSize().bits() == 8) {
     s << "i.insert_byte(" << GetName() << "_);";
-  } else if (GetSize().bits() % 8 == 0) {
-    s << "insert(" << GetName() << "_, i);";
   } else {
     s << "insert(" << GetName() << "_, i," << GetSize().bits() << ");";
   }
diff --git a/gd/packet/parser/test/generated_packet_test.cc b/gd/packet/parser/test/generated_packet_test.cc
index 06f60b5..f8454a2 100644
--- a/gd/packet/parser/test/generated_packet_test.cc
+++ b/gd/packet/parser/test/generated_packet_test.cc
@@ -1825,6 +1825,58 @@
     ASSERT_EQ(ltv_vector[i].value_, an_array[i].value_);
   }
 }
+
+vector<uint8_t> byte_sized{
+    0x11,                                            // 1
+    0x21, 0x22,                                      // 2
+    0x31, 0x32, 0x33,                                // 3
+    0x41, 0x42, 0x43, 0x44,                          // 4
+    0x51, 0x52, 0x53, 0x54, 0x55,                    // 5
+    0x61, 0x62, 0x63, 0x64, 0x65, 0x66,              // 6
+    0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,        // 7
+    0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88,  // 8
+};
+
+TEST(GeneratedPacketTest, testByteSizedFields) {
+  uint64_t array[9]{
+      0xbadbadbad,
+      0x11,                // 1
+      0x2221,              // 2
+      0x333231,            // 3
+      0x44434241,          // 4
+      0x5554535251,        // 5
+      0x666564636261,      // 6
+      0x77767574737271,    // 7
+      0x8887868584838281,  // 8
+  };
+  auto packet =
+      ByteSizedFieldsBuilder::Create(array[1], array[2], array[3], array[4], array[5], array[6], array[7], array[8]);
+  ASSERT_EQ(byte_sized.size(), packet->size());
+
+  std::shared_ptr<std::vector<uint8_t>> packet_bytes = std::make_shared<std::vector<uint8_t>>();
+  BitInserter it(*packet_bytes);
+  packet->Serialize(it);
+
+  ASSERT_EQ(byte_sized.size(), packet_bytes->size());
+  for (size_t i = 0; i < byte_sized.size(); i++) {
+    ASSERT_EQ(byte_sized[i], packet_bytes->at(i));
+  }
+
+  PacketView<kLittleEndian> packet_bytes_view(packet_bytes);
+  auto view = ByteSizedFieldsView::Create(packet_bytes_view);
+  ASSERT_TRUE(view.IsValid());
+  ASSERT_EQ(array[1], view.GetOne());
+  ASSERT_EQ(array[2], view.GetTwo());
+  ASSERT_EQ(array[3], view.GetThree());
+  ASSERT_EQ(array[4], view.GetFour());
+  ASSERT_EQ(array[5], view.GetFive());
+  ASSERT_EQ(array[6], view.GetSix());
+  ASSERT_EQ(array[7], view.GetSeven());
+  ASSERT_EQ(array[8], view.GetEight());
+}
+
+DEFINE_AND_INSTANTIATE_ByteSizedFieldsReflectionTest(byte_sized);
+
 }  // namespace parser
 }  // namespace packet
 }  // namespace bluetooth
diff --git a/gd/packet/parser/test/test_packets.pdl b/gd/packet/parser/test/test_packets.pdl
index 3c24509..2b612cc 100644
--- a/gd/packet/parser/test/test_packets.pdl
+++ b/gd/packet/parser/test/test_packets.pdl
@@ -394,3 +394,14 @@
   one_array : LengthTypeValueStruct[],
   _padding_[40],
 }
+
+packet ByteSizedFields {
+  one : 8,
+  two : 16,
+  three : 24,
+  four : 32,
+  five : 40,
+  six : 48,
+  seven : 56,
+  eight : 64,
+}
diff --git a/gd/packet/raw_builder.cc b/gd/packet/raw_builder.cc
index ec5159b..ec2ff68 100644
--- a/gd/packet/raw_builder.cc
+++ b/gd/packet/raw_builder.cc
@@ -17,6 +17,7 @@
 #include "packet/raw_builder.h"
 
 #include <algorithm>
+#include <utility>
 
 #include "os/log.h"
 
@@ -27,7 +28,7 @@
 namespace packet {
 
 RawBuilder::RawBuilder(size_t max_bytes) : max_bytes_(max_bytes) {}
-RawBuilder::RawBuilder(std::vector<uint8_t> vec) : max_bytes_(vec.size()), payload_(vec) {}
+RawBuilder::RawBuilder(std::vector<uint8_t> vec) : payload_(std::move(vec)) {}
 
 bool RawBuilder::AddOctets(size_t octets, const vector<uint8_t>& bytes) {
   if (payload_.size() + octets > max_bytes_) return false;
diff --git a/gd/packet/raw_builder.h b/gd/packet/raw_builder.h
index 9b0e959..1c9552a 100644
--- a/gd/packet/raw_builder.h
+++ b/gd/packet/raw_builder.h
@@ -64,7 +64,7 @@
   // - the new size of the payload is still <= |max_bytes_|
   bool AddOctets(size_t octets, uint64_t value);
 
-  size_t max_bytes_{255};
+  size_t max_bytes_{0xffff};
 
   // Underlying containers for storing the actual packet
   std::vector<uint8_t> payload_;
diff --git a/gd/packet/raw_builder_unittest.cc b/gd/packet/raw_builder_unittest.cc
index 5210fb6..64ca0ed 100644
--- a/gd/packet/raw_builder_unittest.cc
+++ b/gd/packet/raw_builder_unittest.cc
@@ -65,5 +65,48 @@
   ASSERT_EQ(count, packet);
 }
 
+TEST(RawBuilderTest, buildStartingWithVector) {
+  std::vector<uint8_t> count_first(count.begin(), count.begin() + 0x8);
+  std::unique_ptr<RawBuilder> count_builder = std::make_unique<RawBuilder>(count_first);
+  count_builder->AddOctets4(0x0b0a0908);
+  count_builder->AddOctets2(0x0d0c);
+  count_builder->AddOctets1(0x0e);
+  count_builder->AddOctets1(0x0f);
+  count_builder->AddOctets8(0x1716151413121110);
+  std::vector<uint8_t> count_last(count.begin() + 0x18, count.end());
+  count_builder->AddOctets(count_last);
+
+  ASSERT_EQ(count.size(), count_builder->size());
+
+  std::vector<uint8_t> packet;
+  BitInserter it(packet);
+
+  count_builder->Serialize(it);
+
+  ASSERT_EQ(count, packet);
+}
+
+TEST(RawBuilderTest, testMaxBytes) {
+  const size_t kMaxBytes = count.size();
+  std::unique_ptr<RawBuilder> count_builder = std::make_unique<RawBuilder>(kMaxBytes);
+  ASSERT_TRUE(count_builder->AddOctets(count));
+  ASSERT_FALSE(count_builder->AddOctets4(0x0b0a0908));
+  ASSERT_FALSE(count_builder->AddOctets2(0x0d0c));
+  ASSERT_FALSE(count_builder->AddOctets1(0x0e));
+  ASSERT_FALSE(count_builder->AddOctets1(0x0f));
+  ASSERT_FALSE(count_builder->AddOctets8(0x1716151413121110));
+  std::vector<uint8_t> count_last(count.begin() + 0x18, count.end());
+  ASSERT_FALSE(count_builder->AddOctets(count_last));
+
+  ASSERT_EQ(count.size(), count_builder->size());
+
+  std::vector<uint8_t> packet;
+  BitInserter it(packet);
+
+  count_builder->Serialize(it);
+
+  ASSERT_EQ(count, packet);
+}
+
 }  // namespace packet
 }  // namespace bluetooth
diff --git a/gd/shim/l2cap.cc b/gd/shim/l2cap.cc
index d703972..7af8f77 100644
--- a/gd/shim/l2cap.cc
+++ b/gd/shim/l2cap.cc
@@ -50,8 +50,7 @@
 
 using ServiceInterfaceCallback =
     std::function<void(l2cap::Psm psm, l2cap::classic::DynamicChannelManager::RegistrationResult result)>;
-using ConnectionInterfaceCallback =
-    std::function<void(l2cap::Psm psm, std::unique_ptr<l2cap::classic::DynamicChannel>)>;
+using ConnectionInterfaceCallback = std::function<void(l2cap::Psm psm, std::unique_ptr<l2cap::DynamicChannel>)>;
 
 std::unique_ptr<packet::RawBuilder> MakeUniquePacket(const uint8_t* data, size_t len) {
   packet::RawBuilder builder;
@@ -63,7 +62,7 @@
 
 class ConnectionInterface {
  public:
-  ConnectionInterface(ConnectionInterfaceDescriptor cid, std::unique_ptr<l2cap::classic::DynamicChannel> channel,
+  ConnectionInterface(ConnectionInterfaceDescriptor cid, std::unique_ptr<l2cap::DynamicChannel> channel,
                       os::Handler* handler)
       : cid_(cid), channel_(std::move(channel)), handler_(handler), on_data_ready_callback_(nullptr),
         on_connection_closed_callback_(nullptr), address_(channel_->GetDevice()) {
@@ -139,7 +138,7 @@
 
  private:
   const ConnectionInterfaceDescriptor cid_;
-  const std::unique_ptr<l2cap::classic::DynamicChannel> channel_;
+  const std::unique_ptr<l2cap::DynamicChannel> channel_;
   os::Handler* handler_;
 
   ReadDataReadyCallback on_data_ready_callback_;
@@ -155,7 +154,7 @@
 
 struct ConnectionInterfaceManager {
  public:
-  ConnectionInterfaceDescriptor AddChannel(std::unique_ptr<l2cap::classic::DynamicChannel> channel);
+  ConnectionInterfaceDescriptor AddChannel(std::unique_ptr<l2cap::DynamicChannel> channel);
   void RemoveConnection(ConnectionInterfaceDescriptor cid);
 
   void SetReadDataReadyCallback(ConnectionInterfaceDescriptor cid, ReadDataReadyCallback on_data_ready);
@@ -218,8 +217,7 @@
   return current_connection_interface_descriptor_++;
 }
 
-ConnectionInterfaceDescriptor ConnectionInterfaceManager::AddChannel(
-    std::unique_ptr<l2cap::classic::DynamicChannel> channel) {
+ConnectionInterfaceDescriptor ConnectionInterfaceManager::AddChannel(std::unique_ptr<l2cap::DynamicChannel> channel) {
   if (!HasResources()) {
     return kInvalidConnectionInterfaceDescriptor;
   }
@@ -267,7 +265,7 @@
       : connection_interface_manager_(connection_interface_manager), psm_(psm), address_(address),
         on_open_(std::move(on_open)), completed_(std::move(completed)) {}
 
-  void OnConnectionOpen(std::unique_ptr<l2cap::classic::DynamicChannel> channel) {
+  void OnConnectionOpen(std::unique_ptr<l2cap::DynamicChannel> channel) {
     LOG_DEBUG("Local initiated connection is open to device:%s for psm:%hd", address_.ToString().c_str(), psm_);
     ConnectionInterfaceDescriptor cid = connection_interface_manager_->AddChannel(std::move(channel));
     completed_.set_value(cid);
@@ -322,7 +320,7 @@
     completed_.set_value();
   }
 
-  void OnConnectionOpen(std::unique_ptr<l2cap::classic::DynamicChannel> channel) {
+  void OnConnectionOpen(std::unique_ptr<l2cap::DynamicChannel> channel) {
     LOG_DEBUG("Remote initiated connection is open from device:%s for psm:%hd", channel->GetDevice().ToString().c_str(),
               psm_);
     hci::Address address = channel->GetDevice();
diff --git a/main/Android.bp b/main/Android.bp
index ef7dba6..2a5b8cf 100644
--- a/main/Android.bp
+++ b/main/Android.bp
@@ -69,12 +69,9 @@
         "libtinyxml2",
         "libz",
         "libcrypto",
-        "android.hardware.keymaster@4.0",
-        "android.hardware.keymaster@3.0",
-        "libkeymaster4support",
-        "libkeystore_aidl",
-        "libkeystore_binder",
-        "libkeystore_parcelables",
+        //"android.hardware.keymaster@4.0",
+        //"libkeymaster4support",
+        //"libkeystore_binder",
     ],
     static_libs: [
         "libbt-sbc-decoder",
diff --git a/vendor_libs/test_vendor_lib/Android.bp b/vendor_libs/test_vendor_lib/Android.bp
index 7d20b25..16662c2 100644
--- a/vendor_libs/test_vendor_lib/Android.bp
+++ b/vendor_libs/test_vendor_lib/Android.bp
@@ -61,9 +61,6 @@
         "libbase",
         "liblog",
     ],
-    whole_static_libs: [
-        "libbt-rootcanal-packets",
-    ],
     static_libs: [
         "libbt-rootcanal-types",
     ],
diff --git a/vendor_libs/test_vendor_lib/include/hci.h b/vendor_libs/test_vendor_lib/include/hci.h
index a2e696b..eaa74c0 100644
--- a/vendor_libs/test_vendor_lib/include/hci.h
+++ b/vendor_libs/test_vendor_lib/include/hci.h
@@ -17,11 +17,6 @@
 #pragma once
 #include <cstdint>
 
-#include "include/hci/event_code.h"
-#include "include/hci/le_sub_event_code.h"
-#include "include/hci/op_code.h"
-#include "include/hci/status.h"
-
 namespace test_vendor_lib {
 namespace hci {
 
@@ -33,36 +28,5 @@
   EVENT = 4,
 };
 
-enum class LinkType : uint8_t {
-  SCO = 0x00,
-  ACL = 0x01,
-  ESCO = 0x02,
-};
-
-enum class LoopbackMode : uint8_t {
-  NO = 0x00,
-  LOCAL = 0x01,
-  REMOTE = 0x02,
-};
-
-/* HCI, PAL, and LMP Version numbers are the same */
-enum class Version : uint8_t {
-  V1_0 = 0,
-  V1_1 = 1,
-  V1_2 = 2,
-  V2_0 = 3,
-  V2_1 = 4,
-  V3_0 = 5,
-  V4_0 = 6,
-  V4_1 = 7,
-  V4_2 = 8,
-  V5_0 = 9,
-};
-
-enum class Role : uint8_t {
-  MASTER = 0x00,
-  SLAVE = 0x01,
-};
-
 }  // namespace hci
 }  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/include/hci/event_code.h b/vendor_libs/test_vendor_lib/include/hci/event_code.h
deleted file mode 100644
index 306e522..0000000
--- a/vendor_libs/test_vendor_lib/include/hci/event_code.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-#include <cstdint>
-
-namespace test_vendor_lib {
-namespace hci {
-
-enum class EventCode : uint8_t {
-  INQUIRY_COMPLETE = 0x01,
-  INQUIRY_RESULT = 0x02,
-  CONNECTION_COMPLETE = 0x03,
-  CONNECTION_REQUEST = 0x04,
-  DISCONNECTION_COMPLETE = 0x05,
-  AUTHENTICATION_COMPLETE = 0x06,
-  REMOTE_NAME_REQUEST_COMPLETE = 0x07,
-  ENCRYPTION_CHANGE = 0x08,
-  CHANGE_CONNECTION_LINK_KEY_COMPLETE = 0x09,
-  MASTER_LINK_KEY_COMPLETE = 0x0A,
-  READ_REMOTE_SUPPORTED_FEATURES_COMPLETE = 0x0B,
-  READ_REMOTE_VERSION_INFORMATION_COMPLETE = 0x0C,
-  QOS_SETUP_COMPLETE = 0x0D,
-  COMMAND_COMPLETE = 0x0E,
-  COMMAND_STATUS = 0x0F,
-  HARDWARE_ERROR = 0x10,
-  FLUSH_OCCURED = 0x11,
-  ROLE_CHANGE = 0x12,
-  NUMBER_OF_COMPLETED_PACKETS = 0x13,
-  MODE_CHANGE = 0x14,
-  RETURN_LINK_KEYS = 0x15,
-  PIN_CODE_REQUEST = 0x16,
-  LINK_KEY_REQUEST = 0x17,
-  LINK_KEY_NOTIFICATION = 0x18,
-  LOOPBACK_COMMAND = 0x19,
-  DATA_BUFFER_OVERFLOW = 0x1A,
-  MAX_SLOTS_CHANGE = 0x1B,
-  READ_CLOCK_OFFSET_COMPLETE = 0x1C,
-  CONNECTION_PACKET_TYPE_CHANGED = 0x1D,
-  QOS_VIOLATION = 0x1E,
-  PAGE_SCAN_REPETITION_MODE_CHANGE = 0x20,
-  FLOW_SPECIFICATION_COMPLETE = 0x21,
-  INQUIRY_RESULT_WITH_RSSI = 0x22,
-  READ_REMOTE_EXTENDED_FEATURES_COMPLETE = 0x23,
-  SYNCHRONOUS_CONNECTION_COMPLETE = 0x2C,
-  SYNCHRONOUS_CONNECTION_CHANGED = 0x2D,
-  SNIFF_SUBRATING = 0x2E,
-  EXTENDED_INQUIRY_RESULT = 0x2F,
-  ENCRYPTION_KEY_REFRESH_COMPLETE = 0x30,
-  IO_CAPABILITY_REQUEST = 0x31,
-  IO_CAPABILITY_RESPONSE = 0x32,
-  USER_CONFIRMATION_REQUEST = 0x33,
-  USER_PASSKEY_REQUEST = 0x34,
-  REMOTE_OOB_DATA_REQUEST = 0x35,
-  SIMPLE_PAIRING_COMPLETE = 0x36,
-  LINK_SUPERVISION_TIMEOUT_CHANGED = 0x38,
-  ENHANCED_FLUSH_COMPLETE = 0x39,
-  USER_PASSKEY_NOTIFICATION = 0x3B,
-  KEYPRESS_NOTIFICATION = 0x3C,
-  REMOTE_HOST_SUPPORTED_FEATURES_NOTIFICATION = 0x3D,
-  LE_META_EVENT = 0x3e,
-  PHYSICAL_LINK_COMPLETE = 0x40,
-  CHANNEL_SELECTED = 0x41,
-  DISCONNECTION_PHYSICAL_LINK_COMPLETE = 0x42,
-  PHYSICAL_LINK_LOSS_EARLY_WARNING = 0x43,
-  PHYSICAL_LINK_RECOVERY = 0x44,
-  LOGICAL_LINK_COMPLETE = 0x45,
-  DISCONNECTION_LOGICAL_LINK_COMPLETE = 0x46,
-  FLOW_SPEC_MODIFY_COMPLETE = 0x47,
-  NUMBER_OF_COMPLETED_DATA_BLOCKS = 0x48,
-  SHORT_RANGE_MODE_CHANGE_COMPLETE = 0x4C,
-};
-}
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/include/hci/le_sub_event_code.h b/vendor_libs/test_vendor_lib/include/hci/le_sub_event_code.h
deleted file mode 100644
index 42edecd..0000000
--- a/vendor_libs/test_vendor_lib/include/hci/le_sub_event_code.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-#include <cstdint>
-
-namespace test_vendor_lib {
-namespace hci {
-
-enum class LeSubEventCode : uint8_t {
-  CONNECTION_COMPLETE = 0x01,
-  ADVERTISING_REPORT = 0x02,
-  CONNECTION_UPDATE_COMPLETE = 0x03,
-  READ_REMOTE_FEATURES_COMPLETE = 0x04,
-  LONG_TERM_KEY_REQUEST = 0x05,
-  REMOTE_CONNECTION_PARAMETER_REQUEST = 0x06,
-  DATA_LENGTH_CHANGE = 0x07,
-  ENHANCED_CONNECTION_COMPLETE = 0x0a,
-  DIRECTED_ADVERTISING_REPORT = 0x0b,
-  PHY_UPDATE_COMPLETE = 0x0c,
-  EXTENDED_ADVERTISING_REPORT = 0x0D,
-  PERIODIC_ADVERTISING_SYNC_ESTABLISHED = 0x0E,
-  PERIODIC_ADVERTISING_REPORT = 0x0F,
-  PERIODIC_ADVERTISING_SYNC_LOST = 0x10,
-  SCAN_TIMEOUT = 0x11,
-  ADVERTISING_SET_TERMINATED = 0x12,
-  SCAN_REQUEST_RECEIVED = 0x13,
-};
-}
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/include/hci/op_code.h b/vendor_libs/test_vendor_lib/include/hci/op_code.h
deleted file mode 100644
index 64f9947..0000000
--- a/vendor_libs/test_vendor_lib/include/hci/op_code.h
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Copyright 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-#include <cstdint>
-
-namespace test_vendor_lib {
-namespace hci {
-
-using CommandGroups = enum {
-  LINK_CONTROL = 0x01 << 10,             /* 0x0400 */
-  LINK_POLICY = 0x02 << 10,              /* 0x0800 */
-  CONTROLLER_AND_BASEBAND = 0x03 << 10,  /* 0x0C00 */
-  INFORMATIONAL_PARAMETERS = 0x04 << 10, /* 0x1000 */
-  STATUS_PARAMETERS = 0x05 << 10,        /* 0x1400 */
-  TESTING = 0x06 << 10,                  /* 0x1800 */
-  LE_CONTROLLER = 0x08 << 10,            /* 0x2000 */
-  VENDOR_SPECIFIC = 0x3F << 10,          /* 0xFC00 */
-};
-
-enum class OpCode : uint16_t {
-  NONE = 0x0000,
-
-  /* LINK_CONTROL */
-  INQUIRY = LINK_CONTROL | 0x0001,
-  INQUIRY_CANCEL = LINK_CONTROL | 0x0002,
-  PERIODIC_INQUIRY_MODE = LINK_CONTROL | 0x0003,
-  EXIT_PERIODIC_INQUIRY_MODE = LINK_CONTROL | 0x0004,
-  CREATE_CONNECTION = LINK_CONTROL | 0x0005,
-  DISCONNECT = LINK_CONTROL | 0x0006,
-  CREATE_CONNECTION_CANCEL = LINK_CONTROL | 0x0008,
-  ACCEPT_CONNECTION_REQUEST = LINK_CONTROL | 0x0009,
-  REJECT_CONNECTION_REQUEST = LINK_CONTROL | 0x000A,
-  LINK_KEY_REQUEST_REPLY = LINK_CONTROL | 0x000B,
-  LINK_KEY_REQUEST_NEGATIVE_REPLY = LINK_CONTROL | 0x000C,
-  PIN_CODE_REQUEST_REPLY = LINK_CONTROL | 0x000D,
-  PIN_CODE_REQUEST_NEGATIVE_REPLY = LINK_CONTROL | 0x000E,
-  CHANGE_CONNECTION_PACKET_TYPE = LINK_CONTROL | 0x000F,
-  AUTHENTICATION_REQUESTED = LINK_CONTROL | 0x0011,
-  SET_CONNECTION_ENCRYPTION = LINK_CONTROL | 0x0013,
-  CHANGE_CONNECTION_LINK_KEY = LINK_CONTROL | 0x0015,
-  MASTER_LINK_KEY = LINK_CONTROL | 0x0017,
-  REMOTE_NAME_REQUEST = LINK_CONTROL | 0x0019,
-  REMOTE_NAME_REQUEST_CANCEL = LINK_CONTROL | 0x001A,
-  READ_REMOTE_SUPPORTED_FEATURES = LINK_CONTROL | 0x001B,
-  READ_REMOTE_EXTENDED_FEATURES = LINK_CONTROL | 0x001C,
-  READ_REMOTE_VERSION_INFORMATION = LINK_CONTROL | 0x001D,
-  READ_CLOCK_OFFSET = LINK_CONTROL | 0x001F,
-  READ_LMP_HANDLE = LINK_CONTROL | 0x0020,
-  SETUP_SYNCHRONOUS_CONNECTION = LINK_CONTROL | 0x0028,
-  ACCEPT_SYNCHRONOUS_CONNECTION = LINK_CONTROL | 0x0029,
-  REJECT_SYNCHRONOUS_CONNECTION = LINK_CONTROL | 0x002A,
-  IO_CAPABILITY_REQUEST_REPLY = LINK_CONTROL | 0x002B,
-  USER_CONFIRMATION_REQUEST_REPLY = LINK_CONTROL | 0x002C,
-  USER_CONFIRMATION_REQUEST_NEGATIVE_REPLY = LINK_CONTROL | 0x002D,
-  USER_PASSKEY_REQUEST_REPLY = LINK_CONTROL | 0x002E,
-  USER_PASSKEY_REQUEST_NEGATIVE_REPLY = LINK_CONTROL | 0x002F,
-  REMOTE_OOB_DATA_REQUEST_REPLY = LINK_CONTROL | 0x0030,
-  REMOTE_OOB_DATA_REQUEST_NEGATIVE_REPLY = LINK_CONTROL | 0x0033,
-  IO_CAPABILITY_REQUEST_NEGATIVE_REPLY = LINK_CONTROL | 0x0034,
-  ENHANCED_SETUP_SYNCHRONOUS_CONNECTION = LINK_CONTROL | 0x003D,
-  ENHANCED_ACCEPT_SYNCHRONOUS_CONNECTION = LINK_CONTROL | 0x003E,
-
-  /* LINK_POLICY */
-  HOLD_MODE = LINK_POLICY | 0x0001,
-  SNIFF_MODE = LINK_POLICY | 0x0003,
-  EXIT_SNIFF_MODE = LINK_POLICY | 0x0004,
-  QOS_SETUP = LINK_POLICY | 0x0007,
-  ROLE_DISCOVERY = LINK_POLICY | 0x0009,
-  SWITCH_ROLE = LINK_POLICY | 0x000B,
-  READ_LINK_POLICY_SETTINGS = LINK_POLICY | 0x000C,
-  WRITE_LINK_POLICY_SETTINGS = LINK_POLICY | 0x000D,
-  READ_DEFAULT_LINK_POLICY_SETTINGS = LINK_POLICY | 0x000E,
-  WRITE_DEFAULT_LINK_POLICY_SETTINGS = LINK_POLICY | 0x000F,
-  FLOW_SPECIFICATION = LINK_POLICY | 0x0010,
-  SNIFF_SUBRATING = LINK_POLICY | 0x0011,
-
-  /* CONTROLLER_AND_BASEBAND */
-  SET_EVENT_MASK = CONTROLLER_AND_BASEBAND | 0x0001,
-  RESET = CONTROLLER_AND_BASEBAND | 0x0003,
-  SET_EVENT_FILTER = CONTROLLER_AND_BASEBAND | 0x0005,
-  FLUSH = CONTROLLER_AND_BASEBAND | 0x0008,
-  READ_PIN_TYPE = CONTROLLER_AND_BASEBAND | 0x0009,
-  WRITE_PIN_TYPE = CONTROLLER_AND_BASEBAND | 0x000A,
-  CREATE_NEW_UNIT_KEY = CONTROLLER_AND_BASEBAND | 0x000B,
-  READ_STORED_LINK_KEY = CONTROLLER_AND_BASEBAND | 0x000D,
-  WRITE_STORED_LINK_KEY = CONTROLLER_AND_BASEBAND | 0x0011,
-  DELETE_STORED_LINK_KEY = CONTROLLER_AND_BASEBAND | 0x0012,
-  WRITE_LOCAL_NAME = CONTROLLER_AND_BASEBAND | 0x0013,
-  READ_LOCAL_NAME = CONTROLLER_AND_BASEBAND | 0x0014,
-  READ_CONNECTION_ACCEPT_TIMEOUT = CONTROLLER_AND_BASEBAND | 0x0015,
-  WRITE_CONNECTION_ACCEPT_TIMEOUT = CONTROLLER_AND_BASEBAND | 0x0016,
-  READ_PAGE_TIMEOUT = CONTROLLER_AND_BASEBAND | 0x0017,
-  WRITE_PAGE_TIMEOUT = CONTROLLER_AND_BASEBAND | 0x0018,
-  READ_SCAN_ENABLE = CONTROLLER_AND_BASEBAND | 0x0019,
-  WRITE_SCAN_ENABLE = CONTROLLER_AND_BASEBAND | 0x001A,
-  READ_PAGE_SCAN_ACTIVITY = CONTROLLER_AND_BASEBAND | 0x001B,
-  WRITE_PAGE_SCAN_ACTIVITY = CONTROLLER_AND_BASEBAND | 0x001C,
-  READ_INQUIRY_SCAN_ACTIVITY = CONTROLLER_AND_BASEBAND | 0x001D,
-  WRITE_INQUIRY_SCAN_ACTIVITY = CONTROLLER_AND_BASEBAND | 0x001E,
-  READ_AUTHENTICATION_ENABLE = CONTROLLER_AND_BASEBAND | 0x001F,
-  WRITE_AUTHENTICATION_ENABLE = CONTROLLER_AND_BASEBAND | 0x0020,
-  READ_CLASS_OF_DEVICE = CONTROLLER_AND_BASEBAND | 0x0023,
-  WRITE_CLASS_OF_DEVICE = CONTROLLER_AND_BASEBAND | 0x0024,
-  READ_VOICE_SETTING = CONTROLLER_AND_BASEBAND | 0x0025,
-  WRITE_VOICE_SETTING = CONTROLLER_AND_BASEBAND | 0x0026,
-  READ_AUTOMATIC_FLUSH_TIMEOUT = CONTROLLER_AND_BASEBAND | 0x0027,
-  WRITE_AUTOMATIC_FLUSH_TIMEOUT = CONTROLLER_AND_BASEBAND | 0x0028,
-  READ_NUM_BROADCAST_RETRANSMITS = CONTROLLER_AND_BASEBAND | 0x0029,
-  WRITE_NUM_BROADCAST_RETRANSMITS = CONTROLLER_AND_BASEBAND | 0x002A,
-  READ_HOLD_MODE_ACTIVITY = CONTROLLER_AND_BASEBAND | 0x002B,
-  WRITE_HOLD_MODE_ACTIVITY = CONTROLLER_AND_BASEBAND | 0x002C,
-  READ_TRANSMIT_POWER_LEVEL = CONTROLLER_AND_BASEBAND | 0x002D,
-  READ_SYNCHRONOUS_FLOW_CONTROL_ENABLE = CONTROLLER_AND_BASEBAND | 0x002E,
-  WRITE_SYNCHRONOUS_FLOW_CONTROL_ENABLE = CONTROLLER_AND_BASEBAND | 0x002F,
-  SET_CONTROLLER_TO_HOST_FLOW_CONTROL = CONTROLLER_AND_BASEBAND | 0x0031,
-  HOST_BUFFER_SIZE = CONTROLLER_AND_BASEBAND | 0x0033,
-  HOST_NUM_COMPLETED_PACKETS = CONTROLLER_AND_BASEBAND | 0x0035,
-  READ_LINK_SUPERVISION_TIMEOUT = CONTROLLER_AND_BASEBAND | 0x0036,
-  WRITE_LINK_SUPERVISION_TIMEOUT = CONTROLLER_AND_BASEBAND | 0x0037,
-  READ_NUMBER_OF_SUPPORTED_IAC = CONTROLLER_AND_BASEBAND | 0x0038,
-  READ_CURRENT_IAC_LAP = CONTROLLER_AND_BASEBAND | 0x0039,
-  WRITE_CURRENT_IAC_LAP = CONTROLLER_AND_BASEBAND | 0x003A,
-  SET_AFH_HOST_CHANNEL_CLASSIFICATION = CONTROLLER_AND_BASEBAND | 0x003F,
-  READ_LE_HOST_SUPPORT = CONTROLLER_AND_BASEBAND | 0x6C,
-  WRITE_LE_HOST_SUPPORT = CONTROLLER_AND_BASEBAND | 0x6D,
-  READ_INQUIRY_SCAN_TYPE = CONTROLLER_AND_BASEBAND | 0x0042,
-  WRITE_INQUIRY_SCAN_TYPE = CONTROLLER_AND_BASEBAND | 0x0043,
-  READ_INQUIRY_MODE = CONTROLLER_AND_BASEBAND | 0x0044,
-  WRITE_INQUIRY_MODE = CONTROLLER_AND_BASEBAND | 0x0045,
-  READ_PAGE_SCAN_TYPE = CONTROLLER_AND_BASEBAND | 0x0046,
-  WRITE_PAGE_SCAN_TYPE = CONTROLLER_AND_BASEBAND | 0x0047,
-  READ_AFH_CHANNEL_ASSESSMENT_MODE = CONTROLLER_AND_BASEBAND | 0x0048,
-  WRITE_AFH_CHANNEL_ASSESSMENT_MODE = CONTROLLER_AND_BASEBAND | 0x0049,
-  READ_EXTENDED_INQUIRY_RESPONSE = CONTROLLER_AND_BASEBAND | 0x0051,
-  WRITE_EXTENDED_INQUIRY_RESPONSE = CONTROLLER_AND_BASEBAND | 0x0052,
-  REFRESH_ENCRYPTION_KEY = CONTROLLER_AND_BASEBAND | 0x0053,
-  READ_SIMPLE_PAIRING_MODE = CONTROLLER_AND_BASEBAND | 0x0055,
-  WRITE_SIMPLE_PAIRING_MODE = CONTROLLER_AND_BASEBAND | 0x0056,
-  READ_LOCAL_OOB_DATA = CONTROLLER_AND_BASEBAND | 0x0057,
-  READ_INQUIRY_RESPONSE_TRANSMIT_POWER_LEVEL = CONTROLLER_AND_BASEBAND | 0x0058,
-  WRITE_INQUIRY_TRANSMIT_POWER_LEVEL = CONTROLLER_AND_BASEBAND | 0x0059,
-  SEND_KEYPRESS_NOTIFICATION = CONTROLLER_AND_BASEBAND | 0x0060,
-
-  READ_SECURE_CONNECTIONS_HOST_SUPPORT = CONTROLLER_AND_BASEBAND | 0x0079,
-  WRITE_SECURE_CONNECTIONS_HOST_SUPPORT = CONTROLLER_AND_BASEBAND | 0x007A,
-
-  /* INFORMATIONAL_PARAMETERS */
-  READ_LOCAL_VERSION_INFORMATION = INFORMATIONAL_PARAMETERS | 0x0001,
-  READ_LOCAL_SUPPORTED_COMMANDS = INFORMATIONAL_PARAMETERS | 0x0002,
-  READ_LOCAL_SUPPORTED_FEATURES = INFORMATIONAL_PARAMETERS | 0x0003,
-  READ_LOCAL_EXTENDED_FEATURES = INFORMATIONAL_PARAMETERS | 0x0004,
-  READ_BUFFER_SIZE = INFORMATIONAL_PARAMETERS | 0x0005,
-  READ_BD_ADDR = INFORMATIONAL_PARAMETERS | 0x0009,
-  READ_DATA_BLOCK_SIZE = INFORMATIONAL_PARAMETERS | 0x000A,
-  READ_LOCAL_SUPPORTED_CODECS = INFORMATIONAL_PARAMETERS | 0x000B,
-
-  /* STATUS_PARAMETERS */
-  READ_FAILED_CONTACT_COUNTER = STATUS_PARAMETERS | 0x0001,
-  RESET_FAILED_CONTACT_COUNTER = STATUS_PARAMETERS | 0x0002,
-  READ_LINK_QUALITY = STATUS_PARAMETERS | 0x0003,
-  READ_RSSI = STATUS_PARAMETERS | 0x0005,
-  READ_AFH_CHANNEL_MAP = STATUS_PARAMETERS | 0x0006,
-  READ_CLOCK = STATUS_PARAMETERS | 0x0007,
-  READ_ENCRYPTION_KEY_SIZE = STATUS_PARAMETERS | 0x0008,
-
-  /* TESTING */
-  READ_LOOPBACK_MODE = TESTING | 0x0001,
-  WRITE_LOOPBACK_MODE = TESTING | 0x0002,
-  ENABLE_DEVICE_UNDER_TEST_MODE = TESTING | 0x0003,
-  WRITE_SIMPLE_PAIRING_DEBUG_MODE = TESTING | 0x0004,
-  WRITE_SECURE_CONNECTIONS_TEST_MODE = TESTING | 0x000A,
-
-  /* LE_CONTROLLER */
-  LE_SET_EVENT_MASK = LE_CONTROLLER | 0x0001,
-  LE_READ_BUFFER_SIZE = LE_CONTROLLER | 0x0002,
-  LE_READ_LOCAL_SUPPORTED_FEATURES = LE_CONTROLLER | 0x0003,
-  LE_WRITE_LOCAL_SUPPORTED_FEATURES = LE_CONTROLLER | 0x0004,
-  LE_SET_RANDOM_ADDRESS = LE_CONTROLLER | 0x0005,
-  LE_SET_ADVERTISING_PARAMETERS = LE_CONTROLLER | 0x0006,
-  LE_READ_ADVERTISING_CHANNEL_TX_POWER = LE_CONTROLLER | 0x0007,
-  LE_SET_ADVERTISING_DATA = LE_CONTROLLER | 0x0008,
-  LE_SET_SCAN_RESPONSE_DATA = LE_CONTROLLER | 0x0009,
-  LE_SET_ADVERTISING_ENABLE = LE_CONTROLLER | 0x000A,
-  LE_SET_SCAN_PARAMETERS = LE_CONTROLLER | 0x000B,
-  LE_SET_SCAN_ENABLE = LE_CONTROLLER | 0x000C,
-  LE_CREATE_CONNECTION = LE_CONTROLLER | 0x000D,
-  LE_CREATE_CONNECTION_CANCEL = LE_CONTROLLER | 0x000E,
-  LE_READ_WHITE_LIST_SIZE = LE_CONTROLLER | 0x000F,
-  LE_CLEAR_WHITE_LIST = LE_CONTROLLER | 0x0010,
-  LE_ADD_DEVICE_TO_WHITE_LIST = LE_CONTROLLER | 0x0011,
-  LE_REMOVE_DEVICE_FROM_WHITE_LIST = LE_CONTROLLER | 0x0012,
-  LE_CONNECTION_UPDATE = LE_CONTROLLER | 0x0013,
-  LE_SET_HOST_CHANNEL_CLASSIFICATION = LE_CONTROLLER | 0x0014,
-  LE_READ_CHANNEL_MAP = LE_CONTROLLER | 0x0015,
-  LE_READ_REMOTE_FEATURES = LE_CONTROLLER | 0x0016,
-  LE_ENCRYPT = LE_CONTROLLER | 0x0017,
-  LE_RAND = LE_CONTROLLER | 0x0018,
-  LE_START_ENCRYPTION = LE_CONTROLLER | 0x0019,
-  LE_LONG_TERM_KEY_REQUEST_REPLY = LE_CONTROLLER | 0x001A,
-  LE_LONG_TERM_KEY_REQUEST_NEGATIVE_REPLY = LE_CONTROLLER | 0x001B,
-  LE_READ_SUPPORTED_STATES = LE_CONTROLLER | 0x001C,
-  LE_RECEIVER_TEST = LE_CONTROLLER | 0x001D,
-  LE_TRANSMITTER_TEST = LE_CONTROLLER | 0x001E,
-  LE_TEST_END = LE_CONTROLLER | 0x001F,
-  LE_REMOTE_CONNECTION_PARAMETER_REQUEST_REPLY = LE_CONTROLLER | 0x0020,
-  LE_REMOTE_CONNECTION_PARAMETER_REQUEST_NEGATIVE_REPLY = LE_CONTROLLER | 0x0021,
-
-  LE_SET_DATA_LENGTH = LE_CONTROLLER | 0x0022,
-  LE_READ_SUGGESTED_DEFAULT_DATA_LENGTH = LE_CONTROLLER | 0x0023,
-  LE_WRITE_SUGGESTED_DEFAULT_DATA_LENGTH = LE_CONTROLLER | 0x0024,
-  LE_READ_LOCAL_P_256_PUBLIC_KEY_COMMAND = LE_CONTROLLER | 0x0025,
-  LE_GENERATE_DHKEY_COMMAND = LE_CONTROLLER | 0x0026,
-  LE_ADD_DEVICE_TO_RESOLVING_LIST = LE_CONTROLLER | 0x0027,
-  LE_REMOVE_DEVICE_FROM_RESOLVING_LIST = LE_CONTROLLER | 0x0028,
-  LE_CLEAR_RESOLVING_LIST = LE_CONTROLLER | 0x0029,
-  LE_READ_RESOLVING_LIST_SIZE = LE_CONTROLLER | 0x002A,
-  LE_READ_PEER_RESOLVABLE_ADDRESS = LE_CONTROLLER | 0x002B,
-  LE_READ_LOCAL_RESOLVABLE_ADDRESS = LE_CONTROLLER | 0x002C,
-  LE_SET_ADDRESS_RESOLUTION_ENABLE = LE_CONTROLLER | 0x002D,
-  LE_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT = LE_CONTROLLER | 0x002E,
-  LE_READ_MAXIMUM_DATA_LENGTH = LE_CONTROLLER | 0x002F,
-  LE_READ_PHY = LE_CONTROLLER | 0x0030,
-  LE_SET_DEFAULT_PHY = LE_CONTROLLER | 0x0031,
-  LE_SET_PHY = LE_CONTROLLER | 0x0032,
-  LE_ENHANCED_RECEIVER_TEST = LE_CONTROLLER | 0x0033,
-  LE_ENHANCED_TRANSMITTER_TEST = LE_CONTROLLER | 0x0034,
-  LE_SET_EXTENDED_ADVERTISING_RANDOM_ADDRESS = LE_CONTROLLER | 0x35,
-  LE_SET_EXTENDED_ADVERTISING_PARAMETERS = LE_CONTROLLER | 0x36,
-  LE_SET_EXTENDED_ADVERTISING_DATA = LE_CONTROLLER | 0x37,
-  LE_SET_EXTENDED_ADVERTISING_SCAN_RESPONSE = LE_CONTROLLER | 0x38,
-  LE_SET_EXTENDED_ADVERTISING_ENABLE = LE_CONTROLLER | 0x39,
-  LE_READ_MAXIMUM_ADVERTISING_DATA_LENGTH = LE_CONTROLLER | 0x003A,
-  LE_READ_NUMBER_OF_SUPPORTED_ADVERTISING_SETS = LE_CONTROLLER | 0x003B,
-  LE_REMOVE_ADVERTISING_SET = LE_CONTROLLER | 0x003C,
-  LE_CLEAR_ADVERTISING_SETS = LE_CONTROLLER | 0x003D,
-  LE_SET_PERIODIC_ADVERTISING_PARAM = LE_CONTROLLER | 0x003E,
-  LE_SET_PERIODIC_ADVERTISING_DATA = LE_CONTROLLER | 0x003F,
-  LE_SET_PERIODIC_ADVERTISING_ENABLE = LE_CONTROLLER | 0x0040,
-  LE_SET_EXTENDED_SCAN_PARAMETERS = LE_CONTROLLER | 0x0041,
-  LE_SET_EXTENDED_SCAN_ENABLE = LE_CONTROLLER | 0x0042,
-  LE_EXTENDED_CREATE_CONNECTION = LE_CONTROLLER | 0x0043,
-  LE_PERIODIC_ADVERTISING_CREATE_SYNC = LE_CONTROLLER | 0x0044,
-  LE_PERIODIC_ADVERTISING_CREATE_SYNC_CANCEL = LE_CONTROLLER | 0x0045,
-  LE_PERIODIC_ADVERTISING_TERMINATE_SYNC = LE_CONTROLLER | 0x0046,
-  LE_ADD_DEVICE_TO_PERIODIC_ADVERTISING_LIST = LE_CONTROLLER | 0x0047,
-  LE_REMOVE_DEVICE_FROM_PERIODIC_ADVERTISING_LIST = LE_CONTROLLER | 0x0048,
-  LE_CLEAR_PERIODIC_ADVERTISING_LIST = LE_CONTROLLER | 0x0049,
-  LE_READ_PERIODIC_ADVERTISING_LIST_SIZE = LE_CONTROLLER | 0x004A,
-  LE_READ_TRANSMIT_POWER = LE_CONTROLLER | 0x004B,
-  LE_READ_RF_PATH_COMPENSATION_POWER = LE_CONTROLLER | 0x004C,
-  LE_WRITE_RF_PATH_COMPENSATION_POWER = LE_CONTROLLER | 0x004D,
-  LE_SET_PRIVACY_MODE = LE_CONTROLLER | 0x004E,
-
-  /* VENDOR_SPECIFIC */
-  LE_GET_VENDOR_CAPABILITIES = VENDOR_SPECIFIC | 0x0153,
-  LE_MULTI_ADVT = VENDOR_SPECIFIC | 0x0154,
-  LE_BATCH_SCAN = VENDOR_SPECIFIC | 0x0156,
-  LE_ADV_FILTER = VENDOR_SPECIFIC | 0x0157,
-  LE_TRACK_ADV = VENDOR_SPECIFIC | 0x0158,
-  LE_ENERGY_INFO = VENDOR_SPECIFIC | 0x0159,
-  LE_EXTENDED_SCAN_PARAMS = VENDOR_SPECIFIC | 0x015A,
-  CONTROLLER_DEBUG_INFO = VENDOR_SPECIFIC | 0x015B,
-  CONTROLLER_A2DP_OPCODE = VENDOR_SPECIFIC | 0x015D,
-};
-
-}  // namespace hci
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/include/hci/status.h b/vendor_libs/test_vendor_lib/include/hci/status.h
deleted file mode 100644
index 4452cfa..0000000
--- a/vendor_libs/test_vendor_lib/include/hci/status.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-#include <cstdint>
-
-namespace test_vendor_lib {
-namespace hci {
-
-enum class Status : uint8_t {
-  SUCCESS = 0,
-  UNKNOWN_COMMAND = 1,
-  UNKNOWN_CONNECTION = 2,
-  HARDWARE_FAILURE = 3,
-  PAGE_TIMEOUT = 4,
-  AUTHENTICATION_FAILURE = 5,
-  PIN_OR_KEY_MISSING = 6,
-  MEMORY_CAPACITY_EXCEEDED = 7,
-  CONNECTION_TIMEOUT = 8,
-  COMMAND_DISALLOWED = 0x0c,
-  CONNECTION_REJECTED_LIMITED_RESOURCES = 0x0d,
-  CONNECTION_REJECTED_SECURITY = 0x0e,
-  CONNECTION_REJECTED_UNACCEPTABLE_BD_ADDR = 0x0f,
-  INVALID_HCI_COMMAND_PARAMETERS = 0x12,
-  REMOTE_USER_TERMINATED_CONNECTION = 0x13,
-  CONNECTION_TERMINATED_BY_LOCAL_HOST = 0x16,
-  UNSPECIFIED_ERROR = 0x1f,
-  ENCRYPTION_MODE_NOT_ACCEPTABLE = 0x25,
-  HOST_BUSY_PAIRING = 0x38,
-  CONTROLLER_BUSY = 0x3a,
-};
-}
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc b/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc
index 75b87b0..95bb202 100644
--- a/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc
+++ b/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.cc
@@ -25,17 +25,14 @@
 #include "os/log.h"
 #include "packet/raw_builder.h"
 
-#include "hci.h"
-#include "packets/hci/command_packet_view.h"
-#include "packets/packet_view.h"
-
+using bluetooth::hci::ErrorCode;
+using bluetooth::hci::LoopbackMode;
+using bluetooth::hci::OpCode;
 using std::vector;
-using test_vendor_lib::hci::EventCode;
-using test_vendor_lib::hci::OpCode;
 
 namespace {
 
-size_t LastNonZero(test_vendor_lib::packets::PacketView<true> view) {
+size_t LastNonZero(bluetooth::packet::PacketView<true> view) {
   for (size_t i = view.size() - 1; i > 0; i--) {
     if (view[i] != 0) {
       return i;
@@ -82,7 +79,7 @@
   raw_builder_ptr->AddOctets1(kNumCommandPackets);
   raw_builder_ptr->AddOctets2(command_opcode);
   raw_builder_ptr->AddOctets1(
-      static_cast<uint8_t>(bluetooth::hci::ErrorCode::UNKNOWN_HCI_COMMAND));
+      static_cast<uint8_t>(ErrorCode::UNKNOWN_HCI_COMMAND));
 
   auto packet = bluetooth::hci::EventPacketBuilder::Create(
       bluetooth::hci::EventCode::COMMAND_COMPLETE, std::move(raw_builder_ptr));
@@ -91,7 +88,7 @@
 
 DualModeController::DualModeController(const std::string& properties_filename, uint16_t num_keys)
     : Device(properties_filename), security_manager_(num_keys) {
-  loopback_mode_ = hci::LoopbackMode::NO;
+  loopback_mode_ = LoopbackMode::NO_LOOPBACK;
 
   Address public_address;
   ASSERT(Address::FromString("3C:5A:B4:04:05:06", public_address));
@@ -103,8 +100,9 @@
         DualModeController::SendLinkLayerPacket(packet, phy_type);
       });
 
-#define SET_HANDLER(opcode, method) \
-  active_hci_commands_[static_cast<uint16_t>(opcode)] = [this](packets::PacketView<true> param) { method(param); };
+#define SET_HANDLER(opcode, method)                     \
+  active_hci_commands_[static_cast<uint16_t>(opcode)] = \
+      [this](PacketView<true> param) { method(param); };
   SET_HANDLER(OpCode::RESET, HciReset);
   SET_HANDLER(OpCode::READ_BUFFER_SIZE, HciReadBufferSize);
   SET_HANDLER(OpCode::HOST_BUFFER_SIZE, HciHostBufferSize);
@@ -207,13 +205,13 @@
 #undef SET_HANDLER
 }
 
-void DualModeController::HciSniffSubrating(packets::PacketView<true> args) {
+void DualModeController::HciSniffSubrating(PacketView<true> args) {
   ASSERT_LOG(args.size() == 8, "%s size=%zu", __func__, args.size());
 
   uint16_t handle = args.begin().extract<uint16_t>();
 
   auto packet = bluetooth::hci::SniffSubratingCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS, handle);
+      kNumCommandPackets, ErrorCode::SUCCESS, handle);
   send_event_(std::move(packet));
 }
 
@@ -236,7 +234,7 @@
   bluetooth::hci::PacketView<bluetooth::hci::kLittleEndian> raw_packet(packet);
   auto acl_packet = bluetooth::hci::AclPacketView::Create(raw_packet);
   ASSERT(acl_packet.IsValid());
-  if (loopback_mode_ == hci::LoopbackMode::LOCAL) {
+  if (loopback_mode_ == LoopbackMode::ENABLE_LOCAL) {
     uint16_t handle = acl_packet.GetHandle();
 
     std::vector<bluetooth::hci::CompletedPackets> completed_packets;
@@ -256,7 +254,7 @@
 void DualModeController::HandleSco(std::shared_ptr<std::vector<uint8_t>> packet) {
   bluetooth::hci::PacketView<bluetooth::hci::kLittleEndian> raw_packet(packet);
   auto sco_packet = bluetooth::hci::ScoPacketView::Create(raw_packet);
-  if (loopback_mode_ == hci::LoopbackMode::LOCAL) {
+  if (loopback_mode_ == LoopbackMode::ENABLE_LOCAL) {
     uint16_t handle = sco_packet.GetHandle();
     send_sco_(packet);
     std::vector<bluetooth::hci::CompletedPackets> completed_packets;
@@ -277,14 +275,19 @@
 }
 
 void DualModeController::HandleCommand(std::shared_ptr<std::vector<uint8_t>> packet) {
-  auto command_packet = packets::CommandPacketView::Create(packet);
-  uint16_t opcode = command_packet.GetOpcode();
-  hci::OpCode op = static_cast<hci::OpCode>(opcode);
+  bluetooth::hci::PacketView<bluetooth::hci::kLittleEndian> raw_packet(packet);
+  auto command_packet = bluetooth::hci::CommandPacketView::Create(raw_packet);
+  ASSERT(command_packet.IsValid());
+  auto op = command_packet.GetOpCode();
+  uint16_t opcode = static_cast<uint16_t>(op);
 
-  if (loopback_mode_ == hci::LoopbackMode::LOCAL &&
+  if (loopback_mode_ == LoopbackMode::ENABLE_LOCAL &&
       // Loopback exceptions.
-      op != OpCode::RESET && op != OpCode::SET_CONTROLLER_TO_HOST_FLOW_CONTROL && op != OpCode::HOST_BUFFER_SIZE &&
-      op != OpCode::HOST_NUM_COMPLETED_PACKETS && op != OpCode::READ_BUFFER_SIZE && op != OpCode::READ_LOOPBACK_MODE &&
+      op != OpCode::RESET &&
+      op != OpCode::SET_CONTROLLER_TO_HOST_FLOW_CONTROL &&
+      op != OpCode::HOST_BUFFER_SIZE &&
+      op != OpCode::HOST_NUM_COMPLETED_PACKETS &&
+      op != OpCode::READ_BUFFER_SIZE && op != OpCode::READ_LOOPBACK_MODE &&
       op != OpCode::WRITE_LOOPBACK_MODE) {
     std::unique_ptr<bluetooth::packet::RawBuilder> raw_builder_ptr =
         std::make_unique<bluetooth::packet::RawBuilder>();
@@ -340,22 +343,22 @@
   send_iso_ = callback;
 }
 
-void DualModeController::HciReset(packets::PacketView<true> args) {
+void DualModeController::HciReset(PacketView<true> args) {
   ASSERT_LOG(args.size() == 0, "%s  size=%zu", __func__, args.size());
   link_layer_controller_.Reset();
-  if (loopback_mode_ == hci::LoopbackMode::LOCAL) {
-    loopback_mode_ = hci::LoopbackMode::NO;
+  if (loopback_mode_ == LoopbackMode::ENABLE_LOCAL) {
+    loopback_mode_ = LoopbackMode::NO_LOOPBACK;
   }
 
-  send_event_(bluetooth::hci::ResetCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS));
+  send_event_(bluetooth::hci::ResetCompleteBuilder::Create(kNumCommandPackets,
+                                                           ErrorCode::SUCCESS));
 }
 
-void DualModeController::HciReadBufferSize(packets::PacketView<true> args) {
+void DualModeController::HciReadBufferSize(PacketView<true> args) {
   ASSERT_LOG(args.size() == 0, "%s  size=%zu", __func__, args.size());
 
   auto packet = bluetooth::hci::ReadBufferSizeCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
+      kNumCommandPackets, ErrorCode::SUCCESS,
       properties_.GetAclDataPacketSize(),
       properties_.GetSynchronousDataPacketSize(),
       properties_.GetTotalNumAclDataPackets(),
@@ -363,26 +366,25 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciReadEncryptionKeySize(
-    packets::PacketView<true> args) {
+void DualModeController::HciReadEncryptionKeySize(PacketView<true> args) {
   ASSERT_LOG(args.size() == 2, "%s  size=%zu", __func__, args.size());
 
   uint16_t handle = args.begin().extract<uint16_t>();
 
   auto packet = bluetooth::hci::ReadEncryptionKeySizeCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS, handle,
+      kNumCommandPackets, ErrorCode::SUCCESS, handle,
       properties_.GetEncryptionKeySize());
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciHostBufferSize(packets::PacketView<true> args) {
+void DualModeController::HciHostBufferSize(PacketView<true> args) {
   ASSERT_LOG(args.size() == 7, "%s  size=%zu", __func__, args.size());
   auto packet = bluetooth::hci::HostBufferSizeCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciReadLocalVersionInformation(packets::PacketView<true> args) {
+void DualModeController::HciReadLocalVersionInformation(PacketView<true> args) {
   ASSERT_LOG(args.size() == 0, "%s  size=%zu", __func__, args.size());
 
   bluetooth::hci::LocalVersionInformation local_version_information;
@@ -396,18 +398,18 @@
   local_version_information.lmp_subversion_ = properties_.GetLmpPalSubversion();
   auto packet =
       bluetooth::hci::ReadLocalVersionInformationCompleteBuilder::Create(
-          kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
-          local_version_information);
+          kNumCommandPackets, ErrorCode::SUCCESS, local_version_information);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciReadRemoteVersionInformation(packets::PacketView<true> args) {
+void DualModeController::HciReadRemoteVersionInformation(
+    PacketView<true> args) {
   ASSERT_LOG(args.size() == 2, "%s  size=%zu", __func__, args.size());
 
   uint16_t handle = args.begin().extract<uint16_t>();
 
   auto status = link_layer_controller_.SendCommandToRemoteByHandle(
-      bluetooth::hci::OpCode::READ_REMOTE_VERSION_INFORMATION, args, handle);
+      OpCode::READ_REMOTE_VERSION_INFORMATION, args, handle);
 
   auto packet =
       bluetooth::hci::ReadRemoteVersionInformationStatusBuilder::Create(
@@ -415,15 +417,14 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciReadBdAddr(packets::PacketView<true> args) {
+void DualModeController::HciReadBdAddr(PacketView<true> args) {
   ASSERT_LOG(args.size() == 0, "%s  size=%zu", __func__, args.size());
   auto packet = bluetooth::hci::ReadBdAddrCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
-      properties_.GetAddress());
+      kNumCommandPackets, ErrorCode::SUCCESS, properties_.GetAddress());
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciReadLocalSupportedCommands(packets::PacketView<true> args) {
+void DualModeController::HciReadLocalSupportedCommands(PacketView<true> args) {
   ASSERT_LOG(args.size() == 0, "%s  size=%zu", __func__, args.size());
 
   std::array<uint8_t, 64> supported_commands;
@@ -437,54 +438,53 @@
 
   auto packet =
       bluetooth::hci::ReadLocalSupportedCommandsCompleteBuilder::Create(
-          kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
-          supported_commands);
+          kNumCommandPackets, ErrorCode::SUCCESS, supported_commands);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciReadLocalSupportedFeatures(packets::PacketView<true> args) {
+void DualModeController::HciReadLocalSupportedFeatures(PacketView<true> args) {
   ASSERT_LOG(args.size() == 0, "%s  size=%zu", __func__, args.size());
   auto packet =
       bluetooth::hci::ReadLocalSupportedFeaturesCompleteBuilder::Create(
-          kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
+          kNumCommandPackets, ErrorCode::SUCCESS,
           properties_.GetSupportedFeatures());
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciReadLocalSupportedCodecs(packets::PacketView<true> args) {
+void DualModeController::HciReadLocalSupportedCodecs(PacketView<true> args) {
   ASSERT_LOG(args.size() == 0, "%s  size=%zu", __func__, args.size());
   auto packet = bluetooth::hci::ReadLocalSupportedCodecsCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
-      properties_.GetSupportedCodecs(), properties_.GetVendorSpecificCodecs());
+      kNumCommandPackets, ErrorCode::SUCCESS, properties_.GetSupportedCodecs(),
+      properties_.GetVendorSpecificCodecs());
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciReadLocalExtendedFeatures(packets::PacketView<true> args) {
+void DualModeController::HciReadLocalExtendedFeatures(PacketView<true> args) {
   ASSERT_LOG(args.size() == 1, "%s  size=%zu", __func__, args.size());
   uint8_t page_number = args.begin().extract<uint8_t>();
 
   auto pakcet =
       bluetooth::hci::ReadLocalExtendedFeaturesCompleteBuilder::Create(
-          kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS, page_number,
+          kNumCommandPackets, ErrorCode::SUCCESS, page_number,
           properties_.GetExtendedFeaturesMaximumPageNumber(),
           properties_.GetExtendedFeatures(page_number));
   send_event_(std::move(pakcet));
 }
 
-void DualModeController::HciReadRemoteExtendedFeatures(packets::PacketView<true> args) {
+void DualModeController::HciReadRemoteExtendedFeatures(PacketView<true> args) {
   ASSERT_LOG(args.size() == 3, "%s  size=%zu", __func__, args.size());
 
   uint16_t handle = args.begin().extract<uint16_t>();
 
   auto status = link_layer_controller_.SendCommandToRemoteByHandle(
-      bluetooth::hci::OpCode::READ_REMOTE_EXTENDED_FEATURES, args, handle);
+      OpCode::READ_REMOTE_EXTENDED_FEATURES, args, handle);
 
   auto packet = bluetooth::hci::ReadRemoteExtendedFeaturesStatusBuilder::Create(
       status, kNumCommandPackets);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciSwitchRole(packets::PacketView<true> args) {
+void DualModeController::HciSwitchRole(PacketView<true> args) {
   ASSERT_LOG(args.size() == 7, "%s  size=%zu", __func__, args.size());
 
   Address address = args.begin().extract<Address>();
@@ -497,13 +497,13 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciReadRemoteSupportedFeatures(packets::PacketView<true> args) {
+void DualModeController::HciReadRemoteSupportedFeatures(PacketView<true> args) {
   ASSERT_LOG(args.size() == 2, "%s  size=%zu", __func__, args.size());
 
   uint16_t handle = args.begin().extract<uint16_t>();
 
   auto status = link_layer_controller_.SendCommandToRemoteByHandle(
-      bluetooth::hci::OpCode::READ_REMOTE_SUPPORTED_FEATURES, args, handle);
+      OpCode::READ_REMOTE_SUPPORTED_FEATURES, args, handle);
 
   auto packet =
       bluetooth::hci::ReadRemoteSupportedFeaturesStatusBuilder::Create(
@@ -511,20 +511,20 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciReadClockOffset(packets::PacketView<true> args) {
+void DualModeController::HciReadClockOffset(PacketView<true> args) {
   ASSERT_LOG(args.size() == 2, "%s  size=%zu", __func__, args.size());
 
   uint16_t handle = args.begin().extract<uint16_t>();
 
   auto status = link_layer_controller_.SendCommandToRemoteByHandle(
-      bluetooth::hci::OpCode::READ_CLOCK_OFFSET, args, handle);
+      OpCode::READ_CLOCK_OFFSET, args, handle);
 
   auto packet = bluetooth::hci::ReadClockOffsetStatusBuilder::Create(
       status, kNumCommandPackets);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciIoCapabilityRequestReply(packets::PacketView<true> args) {
+void DualModeController::HciIoCapabilityRequestReply(PacketView<true> args) {
   ASSERT_LOG(args.size() == 9, "%s  size=%zu", __func__, args.size());
 
   auto args_itr = args.begin();
@@ -541,7 +541,8 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciUserConfirmationRequestReply(packets::PacketView<true> args) {
+void DualModeController::HciUserConfirmationRequestReply(
+    PacketView<true> args) {
   ASSERT_LOG(args.size() == 6, "%s  size=%zu", __func__, args.size());
 
   Address peer = args.begin().extract<Address>();
@@ -554,7 +555,8 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciUserConfirmationRequestNegativeReply(packets::PacketView<true> args) {
+void DualModeController::HciUserConfirmationRequestNegativeReply(
+    PacketView<true> args) {
   ASSERT_LOG(args.size() == 6, "%s  size=%zu", __func__, args.size());
 
   Address peer = args.begin().extract<Address>();
@@ -568,7 +570,7 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciUserPasskeyRequestReply(packets::PacketView<true> args) {
+void DualModeController::HciUserPasskeyRequestReply(PacketView<true> args) {
   ASSERT_LOG(args.size() == 10, "%s  size=%zu", __func__, args.size());
 
   auto args_itr = args.begin();
@@ -583,7 +585,8 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciUserPasskeyRequestNegativeReply(packets::PacketView<true> args) {
+void DualModeController::HciUserPasskeyRequestNegativeReply(
+    PacketView<true> args) {
   ASSERT_LOG(args.size() == 6, "%s  size=%zu", __func__, args.size());
 
   Address peer = args.begin().extract<Address>();
@@ -596,7 +599,7 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciRemoteOobDataRequestReply(packets::PacketView<true> args) {
+void DualModeController::HciRemoteOobDataRequestReply(PacketView<true> args) {
   ASSERT_LOG(args.size() == 38, "%s  size=%zu", __func__, args.size());
 
   auto args_itr = args.begin();
@@ -617,7 +620,8 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciRemoteOobDataRequestNegativeReply(packets::PacketView<true> args) {
+void DualModeController::HciRemoteOobDataRequestNegativeReply(
+    PacketView<true> args) {
   ASSERT_LOG(args.size() == 6, "%s  size=%zu", __func__, args.size());
 
   Address peer = args.begin().extract<Address>();
@@ -630,12 +634,13 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciIoCapabilityRequestNegativeReply(packets::PacketView<true> args) {
+void DualModeController::HciIoCapabilityRequestNegativeReply(
+    PacketView<true> args) {
   ASSERT_LOG(args.size() == 7, "%s  size=%zu", __func__, args.size());
 
   auto args_itr = args.begin();
   Address peer = args_itr.extract<Address>();
-  hci::Status reason = args_itr.extract<hci::Status>();
+  ErrorCode reason = args_itr.extract<ErrorCode>();
 
   auto status =
       link_layer_controller_.IoCapabilityRequestNegativeReply(peer, reason);
@@ -646,16 +651,16 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciWriteSimplePairingMode(packets::PacketView<true> args) {
+void DualModeController::HciWriteSimplePairingMode(PacketView<true> args) {
   ASSERT_LOG(args.size() == 1, "%s  size=%zu", __func__, args.size());
   ASSERT(args[0] == 1 || args[0] == 0);
   link_layer_controller_.WriteSimplePairingMode(args[0] == 1);
   auto packet = bluetooth::hci::WriteSimplePairingModeCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciChangeConnectionPacketType(packets::PacketView<true> args) {
+void DualModeController::HciChangeConnectionPacketType(PacketView<true> args) {
   ASSERT_LOG(args.size() == 4, "%s  size=%zu", __func__, args.size());
   auto args_itr = args.begin();
   uint16_t handle = args_itr.extract<uint16_t>();
@@ -669,53 +674,53 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciWriteLeHostSupport(packets::PacketView<true> args) {
+void DualModeController::HciWriteLeHostSupport(PacketView<true> args) {
   ASSERT_LOG(args.size() == 2, "%s  size=%zu", __func__, args.size());
   auto packet = bluetooth::hci::WriteLeHostSupportCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
 void DualModeController::HciWriteSecureConnectionsHostSupport(
-    packets::PacketView<true> args) {
+    PacketView<true> args) {
   ASSERT_LOG(args.size() == 1, "%s  size=%zu", __func__, args.size());
   properties_.SetExtendedFeatures(properties_.GetExtendedFeatures(1) | 0x8, 1);
   auto packet =
       bluetooth::hci::WriteSecureConnectionsHostSupportCompleteBuilder::Create(
-          kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+          kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciSetEventMask(packets::PacketView<true> args) {
+void DualModeController::HciSetEventMask(PacketView<true> args) {
   ASSERT_LOG(args.size() == 8, "%s  size=%zu", __func__, args.size());
   auto packet = bluetooth::hci::SetEventMaskCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciWriteInquiryMode(packets::PacketView<true> args) {
+void DualModeController::HciWriteInquiryMode(PacketView<true> args) {
   ASSERT_LOG(args.size() == 1, "%s  size=%zu", __func__, args.size());
   link_layer_controller_.SetInquiryMode(args[0]);
   auto packet = bluetooth::hci::WriteInquiryModeCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciWritePageScanType(packets::PacketView<true> args) {
+void DualModeController::HciWritePageScanType(PacketView<true> args) {
   ASSERT_LOG(args.size() == 1, "%s  size=%zu", __func__, args.size());
   auto packet = bluetooth::hci::WritePageScanTypeCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciWriteInquiryScanType(packets::PacketView<true> args) {
+void DualModeController::HciWriteInquiryScanType(PacketView<true> args) {
   ASSERT_LOG(args.size() == 1, "%s  size=%zu", __func__, args.size());
   auto packet = bluetooth::hci::WriteInquiryScanTypeCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciAuthenticationRequested(packets::PacketView<true> args) {
+void DualModeController::HciAuthenticationRequested(PacketView<true> args) {
   ASSERT_LOG(args.size() == 2, "%s  size=%zu", __func__, args.size());
   uint16_t handle = args.begin().extract<uint16_t>();
   auto status = link_layer_controller_.AuthenticationRequested(handle);
@@ -725,7 +730,7 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciSetConnectionEncryption(packets::PacketView<true> args) {
+void DualModeController::HciSetConnectionEncryption(PacketView<true> args) {
   ASSERT_LOG(args.size() == 3, "%s  size=%zu", __func__, args.size());
   auto args_itr = args.begin();
   uint16_t handle = args_itr.extract<uint16_t>();
@@ -738,7 +743,7 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciChangeConnectionLinkKey(packets::PacketView<true> args) {
+void DualModeController::HciChangeConnectionLinkKey(PacketView<true> args) {
   ASSERT_LOG(args.size() == 2, "%s  size=%zu", __func__, args.size());
   auto args_itr = args.begin();
   uint16_t handle = args_itr.extract<uint16_t>();
@@ -750,7 +755,7 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciMasterLinkKey(packets::PacketView<true> args) {
+void DualModeController::HciMasterLinkKey(PacketView<true> args) {
   ASSERT_LOG(args.size() == 1, "%s  size=%zu", __func__, args.size());
   auto args_itr = args.begin();
   uint8_t key_flag = args_itr.extract<uint8_t>();
@@ -762,40 +767,40 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciWriteAuthenticationEnable(packets::PacketView<true> args) {
+void DualModeController::HciWriteAuthenticationEnable(PacketView<true> args) {
   ASSERT_LOG(args.size() == 1, "%s  size=%zu", __func__, args.size());
   properties_.SetAuthenticationEnable(args[0]);
   auto packet =
       bluetooth::hci::WriteAuthenticationEnableCompleteBuilder::Create(
-          kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+          kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciReadAuthenticationEnable(packets::PacketView<true> args) {
+void DualModeController::HciReadAuthenticationEnable(PacketView<true> args) {
   ASSERT_LOG(args.size() == 0, "%s  size=%zu", __func__, args.size());
   auto packet = bluetooth::hci::ReadAuthenticationEnableCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
+      kNumCommandPackets, ErrorCode::SUCCESS,
       static_cast<bluetooth::hci::AuthenticationEnable>(
           properties_.GetAuthenticationEnable()));
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciWriteClassOfDevice(packets::PacketView<true> args) {
+void DualModeController::HciWriteClassOfDevice(PacketView<true> args) {
   ASSERT_LOG(args.size() == 3, "%s  size=%zu", __func__, args.size());
   properties_.SetClassOfDevice(args[0], args[1], args[2]);
   auto packet = bluetooth::hci::WriteClassOfDeviceCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciWritePageTimeout(packets::PacketView<true> args) {
+void DualModeController::HciWritePageTimeout(PacketView<true> args) {
   ASSERT_LOG(args.size() == 2, "%s  size=%zu", __func__, args.size());
   auto packet = bluetooth::hci::WritePageTimeoutCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciHoldMode(packets::PacketView<true> args) {
+void DualModeController::HciHoldMode(PacketView<true> args) {
   ASSERT_LOG(args.size() == 6, "%s  size=%zu", __func__, args.size());
   auto args_itr = args.begin();
   uint16_t handle = args_itr.extract<uint16_t>();
@@ -810,7 +815,7 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciSniffMode(packets::PacketView<true> args) {
+void DualModeController::HciSniffMode(PacketView<true> args) {
   ASSERT_LOG(args.size() == 10, "%s  size=%zu", __func__, args.size());
   auto args_itr = args.begin();
   uint16_t handle = args_itr.extract<uint16_t>();
@@ -828,7 +833,7 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciExitSniffMode(packets::PacketView<true> args) {
+void DualModeController::HciExitSniffMode(PacketView<true> args) {
   ASSERT_LOG(args.size() == 2, "%s  size=%zu", __func__, args.size());
   auto args_itr = args.begin();
   uint16_t handle = args_itr.extract<uint16_t>();
@@ -840,7 +845,7 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciQosSetup(packets::PacketView<true> args) {
+void DualModeController::HciQosSetup(PacketView<true> args) {
   ASSERT_LOG(args.size() == 20, "%s  size=%zu", __func__, args.size());
   auto args_itr = args.begin();
   uint16_t handle = args_itr.extract<uint16_t>();
@@ -860,15 +865,16 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciWriteDefaultLinkPolicySettings(packets::PacketView<true> args) {
+void DualModeController::HciWriteDefaultLinkPolicySettings(
+    PacketView<true> args) {
   ASSERT_LOG(args.size() == 2, "%s  size=%zu", __func__, args.size());
   auto packet =
       bluetooth::hci::WriteDefaultLinkPolicySettingsCompleteBuilder::Create(
-          kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+          kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciFlowSpecification(packets::PacketView<true> args) {
+void DualModeController::HciFlowSpecification(PacketView<true> args) {
   ASSERT_LOG(args.size() == 21, "%s  size=%zu", __func__, args.size());
   auto args_itr = args.begin();
   uint16_t handle = args_itr.extract<uint16_t>();
@@ -889,7 +895,7 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciWriteLinkPolicySettings(packets::PacketView<true> args) {
+void DualModeController::HciWriteLinkPolicySettings(PacketView<true> args) {
   ASSERT_LOG(args.size() == 4, "%s  size=%zu", __func__, args.size());
 
   auto args_itr = args.begin();
@@ -904,7 +910,7 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciWriteLinkSupervisionTimeout(packets::PacketView<true> args) {
+void DualModeController::HciWriteLinkSupervisionTimeout(PacketView<true> args) {
   ASSERT_LOG(args.size() == 4, "%s  size=%zu", __func__, args.size());
 
   auto args_itr = args.begin();
@@ -919,7 +925,7 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciReadLocalName(packets::PacketView<true> args) {
+void DualModeController::HciReadLocalName(PacketView<true> args) {
   ASSERT_LOG(args.size() == 0, "%s  size=%zu", __func__, args.size());
 
   std::array<uint8_t, 248> local_name;
@@ -931,103 +937,104 @@
   std::copy_n(properties_.GetName().begin(), len, local_name.begin());
 
   auto packet = bluetooth::hci::ReadLocalNameCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS, local_name);
+      kNumCommandPackets, ErrorCode::SUCCESS, local_name);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciWriteLocalName(packets::PacketView<true> args) {
+void DualModeController::HciWriteLocalName(PacketView<true> args) {
   ASSERT_LOG(args.size() == 248, "%s  size=%zu", __func__, args.size());
   std::vector<uint8_t> clipped(args.begin(), args.begin() + LastNonZero(args) + 1);
   properties_.SetName(clipped);
   auto packet = bluetooth::hci::WriteLocalNameCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciWriteExtendedInquiryResponse(packets::PacketView<true> args) {
+void DualModeController::HciWriteExtendedInquiryResponse(
+    PacketView<true> args) {
   ASSERT_LOG(args.size() == 241, "%s  size=%zu", __func__, args.size());
   // Strip FEC byte and trailing zeros
   std::vector<uint8_t> clipped(args.begin() + 1, args.begin() + LastNonZero(args) + 1);
   properties_.SetExtendedInquiryData(clipped);
   auto packet =
       bluetooth::hci::WriteExtendedInquiryResponseCompleteBuilder::Create(
-          kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+          kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciRefreshEncryptionKey(packets::PacketView<true> args) {
+void DualModeController::HciRefreshEncryptionKey(PacketView<true> args) {
   ASSERT_LOG(args.size() == 2, "%s  size=%zu", __func__, args.size());
   auto args_itr = args.begin();
   uint16_t handle = args_itr.extract<uint16_t>();
   auto status_packet =
       bluetooth::hci::RefreshEncryptionKeyStatusBuilder::Create(
-          bluetooth::hci::ErrorCode::SUCCESS, kNumCommandPackets);
+          ErrorCode::SUCCESS, kNumCommandPackets);
   send_event_(std::move(status_packet));
   // TODO: Support this in the link layer
   auto complete_packet =
       bluetooth::hci::EncryptionKeyRefreshCompleteBuilder::Create(
-          bluetooth::hci::ErrorCode::SUCCESS, handle);
+          ErrorCode::SUCCESS, handle);
   send_event_(std::move(complete_packet));
 }
 
-void DualModeController::HciWriteVoiceSetting(packets::PacketView<true> args) {
+void DualModeController::HciWriteVoiceSetting(PacketView<true> args) {
   ASSERT_LOG(args.size() == 2, "%s  size=%zu", __func__, args.size());
   auto packet = bluetooth::hci::WriteVoiceSettingCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciWriteCurrentIacLap(packets::PacketView<true> args) {
+void DualModeController::HciWriteCurrentIacLap(PacketView<true> args) {
   ASSERT(args.size() > 0);
   ASSERT(args.size() == 1 + (3 * args[0]));  // count + 3-byte IACs
   auto packet = bluetooth::hci::WriteCurrentIacLapCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciWriteInquiryScanActivity(packets::PacketView<true> args) {
+void DualModeController::HciWriteInquiryScanActivity(PacketView<true> args) {
   ASSERT_LOG(args.size() == 4, "%s  size=%zu", __func__, args.size());
   auto packet = bluetooth::hci::WriteInquiryScanActivityCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciWriteScanEnable(packets::PacketView<true> args) {
+void DualModeController::HciWriteScanEnable(PacketView<true> args) {
   ASSERT_LOG(args.size() == 1, "%s  size=%zu", __func__, args.size());
   link_layer_controller_.SetInquiryScanEnable(args[0] & 0x1);
   link_layer_controller_.SetPageScanEnable(args[0] & 0x2);
   auto packet = bluetooth::hci::WriteScanEnableCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciSetEventFilter(packets::PacketView<true> args) {
+void DualModeController::HciSetEventFilter(PacketView<true> args) {
   ASSERT(args.size() > 0);
   auto packet = bluetooth::hci::SetEventFilterCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciInquiry(packets::PacketView<true> args) {
+void DualModeController::HciInquiry(PacketView<true> args) {
   ASSERT_LOG(args.size() == 5, "%s  size=%zu", __func__, args.size());
   link_layer_controller_.SetInquiryLAP(args[0] | (args[1], 8) | (args[2], 16));
   link_layer_controller_.SetInquiryMaxResponses(args[4]);
   link_layer_controller_.StartInquiry(std::chrono::milliseconds(args[3] * 1280));
 
   auto packet = bluetooth::hci::InquiryStatusBuilder::Create(
-      bluetooth::hci::ErrorCode::SUCCESS, kNumCommandPackets);
+      ErrorCode::SUCCESS, kNumCommandPackets);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciInquiryCancel(packets::PacketView<true> args) {
+void DualModeController::HciInquiryCancel(PacketView<true> args) {
   ASSERT_LOG(args.size() == 0, "%s  size=%zu", __func__, args.size());
   link_layer_controller_.InquiryCancel();
   auto packet = bluetooth::hci::InquiryCancelCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciAcceptConnectionRequest(packets::PacketView<true> args) {
+void DualModeController::HciAcceptConnectionRequest(PacketView<true> args) {
   ASSERT_LOG(args.size() == 7, "%s  size=%zu", __func__, args.size());
   Address addr = args.begin().extract<Address>();
   bool try_role_switch = args[6] == 0;
@@ -1038,7 +1045,7 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciRejectConnectionRequest(packets::PacketView<true> args) {
+void DualModeController::HciRejectConnectionRequest(PacketView<true> args) {
   ASSERT_LOG(args.size() == 7, "%s  size=%zu", __func__, args.size());
   auto args_itr = args.begin();
   Address addr = args_itr.extract<Address>();
@@ -1049,7 +1056,7 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLinkKeyRequestReply(packets::PacketView<true> args) {
+void DualModeController::HciLinkKeyRequestReply(PacketView<true> args) {
   ASSERT_LOG(args.size() == 22, "%s  size=%zu", __func__, args.size());
   auto args_it = args.begin();
   Address addr = args_it.extract<Address>();
@@ -1060,7 +1067,7 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLinkKeyRequestNegativeReply(packets::PacketView<true> args) {
+void DualModeController::HciLinkKeyRequestNegativeReply(PacketView<true> args) {
   ASSERT_LOG(args.size() == 6, "%s  size=%zu", __func__, args.size());
   Address addr = args.begin().extract<Address>();
   auto status = link_layer_controller_.LinkKeyRequestNegativeReply(addr);
@@ -1070,7 +1077,7 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciDeleteStoredLinkKey(packets::PacketView<true> args) {
+void DualModeController::HciDeleteStoredLinkKey(PacketView<true> args) {
   ASSERT_LOG(args.size() == 7, "%s  size=%zu", __func__, args.size());
 
   uint16_t deleted_keys = 0;
@@ -1085,36 +1092,36 @@
   }
 
   auto packet = bluetooth::hci::DeleteStoredLinkKeyCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS, deleted_keys);
+      kNumCommandPackets, ErrorCode::SUCCESS, deleted_keys);
 
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciRemoteNameRequest(packets::PacketView<true> args) {
+void DualModeController::HciRemoteNameRequest(PacketView<true> args) {
   ASSERT_LOG(args.size() == 10, "%s  size=%zu", __func__, args.size());
 
   Address remote_addr = args.begin().extract<Address>();
 
   auto status = link_layer_controller_.SendCommandToRemoteByAddress(
-      bluetooth::hci::OpCode::REMOTE_NAME_REQUEST, args, remote_addr);
+      OpCode::REMOTE_NAME_REQUEST, args, remote_addr);
 
   auto packet = bluetooth::hci::RemoteNameRequestStatusBuilder::Create(
       status, kNumCommandPackets);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeSetEventMask(packets::PacketView<true> args) {
+void DualModeController::HciLeSetEventMask(PacketView<true> args) {
   ASSERT_LOG(args.size() == 8, "%s  size=%zu", __func__, args.size());
   /*
     uint64_t mask = args.begin().extract<uint64_t>();
     link_layer_controller_.SetLeEventMask(mask);
   */
   auto packet = bluetooth::hci::LeSetEventMaskCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeReadBufferSize(packets::PacketView<true> args) {
+void DualModeController::HciLeReadBufferSize(PacketView<true> args) {
   ASSERT_LOG(args.size() == 0, "%s  size=%zu", __func__, args.size());
 
   bluetooth::hci::LeBufferSize le_buffer_size;
@@ -1122,28 +1129,29 @@
   le_buffer_size.total_num_le_packets_ = properties_.GetTotalNumLeDataPackets();
 
   auto packet = bluetooth::hci::LeReadBufferSizeCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS, le_buffer_size);
+      kNumCommandPackets, ErrorCode::SUCCESS, le_buffer_size);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeReadLocalSupportedFeatures(packets::PacketView<true> args) {
+void DualModeController::HciLeReadLocalSupportedFeatures(
+    PacketView<true> args) {
   ASSERT_LOG(args.size() == 0, "%s  size=%zu", __func__, args.size());
   auto packet =
       bluetooth::hci::LeReadLocalSupportedFeaturesCompleteBuilder::Create(
-          kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
+          kNumCommandPackets, ErrorCode::SUCCESS,
           properties_.GetLeSupportedFeatures());
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeSetRandomAddress(packets::PacketView<true> args) {
+void DualModeController::HciLeSetRandomAddress(PacketView<true> args) {
   ASSERT_LOG(args.size() == 6, "%s  size=%zu", __func__, args.size());
   properties_.SetLeAddress(args.begin().extract<Address>());
   auto packet = bluetooth::hci::LeSetRandomAddressCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeSetAdvertisingParameters(packets::PacketView<true> args) {
+void DualModeController::HciLeSetAdvertisingParameters(PacketView<true> args) {
   ASSERT_LOG(args.size() == 15, "%s  size=%zu", __func__, args.size());
   auto args_itr = args.begin();
   properties_.SetLeAdvertisingParameters(
@@ -1156,27 +1164,27 @@
 
   auto packet =
       bluetooth::hci::LeSetAdvertisingParametersCompleteBuilder::Create(
-          kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+          kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeSetAdvertisingData(packets::PacketView<true> args) {
+void DualModeController::HciLeSetAdvertisingData(PacketView<true> args) {
   ASSERT_LOG(args.size() == 32, "%s  size=%zu", __func__, args.size());
   properties_.SetLeAdvertisement(std::vector<uint8_t>(args.begin() + 1, args.end()));
   auto packet = bluetooth::hci::LeSetAdvertisingDataCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeSetScanResponseData(packets::PacketView<true> args) {
+void DualModeController::HciLeSetScanResponseData(PacketView<true> args) {
   ASSERT_LOG(args.size() == 32, "%s  size=%zu", __func__, args.size());
   properties_.SetLeScanResponse(std::vector<uint8_t>(args.begin() + 1, args.end()));
   auto packet = bluetooth::hci::LeSetScanResponseDataCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeSetAdvertisingEnable(packets::PacketView<true> args) {
+void DualModeController::HciLeSetAdvertisingEnable(PacketView<true> args) {
   ASSERT_LOG(args.size() == 1, "%s  size=%zu", __func__, args.size());
   auto status = link_layer_controller_.SetLeAdvertisingEnable(
       args.begin().extract<uint8_t>());
@@ -1185,7 +1193,7 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeSetScanParameters(packets::PacketView<true> args) {
+void DualModeController::HciLeSetScanParameters(PacketView<true> args) {
   ASSERT_LOG(args.size() == 7, "%s  size=%zu", __func__, args.size());
   link_layer_controller_.SetLeScanType(args[0]);
   link_layer_controller_.SetLeScanInterval(args[1] | (args[2], 8));
@@ -1193,20 +1201,20 @@
   link_layer_controller_.SetLeAddressType(args[5]);
   link_layer_controller_.SetLeScanFilterPolicy(args[6]);
   auto packet = bluetooth::hci::LeSetScanParametersCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeSetScanEnable(packets::PacketView<true> args) {
+void DualModeController::HciLeSetScanEnable(PacketView<true> args) {
   ASSERT_LOG(args.size() == 2, "%s  size=%zu", __func__, args.size());
   link_layer_controller_.SetLeScanEnable(args[0]);
   link_layer_controller_.SetLeFilterDuplicates(args[1]);
   auto packet = bluetooth::hci::LeSetScanEnableCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeCreateConnection(packets::PacketView<true> args) {
+void DualModeController::HciLeCreateConnection(PacketView<true> args) {
   ASSERT_LOG(args.size() == 25, "%s  size=%zu", __func__, args.size());
   auto args_itr = args.begin();
   link_layer_controller_.SetLeScanInterval(args_itr.extract<uint16_t>());
@@ -1235,21 +1243,20 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeConnectionUpdate(packets::PacketView<true> args) {
+void DualModeController::HciLeConnectionUpdate(PacketView<true> args) {
   ASSERT_LOG(args.size() == 14, "%s  size=%zu", __func__, args.size());
 
   auto status_packet = bluetooth::hci::LeConnectionUpdateStatusBuilder::Create(
-      bluetooth::hci::ErrorCode::CONNECTION_REJECTED_UNACCEPTABLE_BD_ADDR,
-      kNumCommandPackets);
+      ErrorCode::CONNECTION_REJECTED_UNACCEPTABLE_BD_ADDR, kNumCommandPackets);
   send_event_(std::move(status_packet));
 
   auto complete_packet =
       bluetooth::hci::LeConnectionUpdateCompleteBuilder::Create(
-          bluetooth::hci::ErrorCode::SUCCESS, 0x0002, 0x0006, 0x0000, 0x01f4);
+          ErrorCode::SUCCESS, 0x0002, 0x0006, 0x0000, 0x01f4);
   send_event_(std::move(complete_packet));
 }
 
-void DualModeController::HciCreateConnection(packets::PacketView<true> args) {
+void DualModeController::HciCreateConnection(PacketView<true> args) {
   ASSERT_LOG(args.size() == 13, "%s  size=%zu", __func__, args.size());
 
   auto args_itr = args.begin();
@@ -1267,7 +1274,7 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciDisconnect(packets::PacketView<true> args) {
+void DualModeController::HciDisconnect(PacketView<true> args) {
   ASSERT_LOG(args.size() == 3, "%s  size=%zu", __func__, args.size());
 
   auto args_itr = args.begin();
@@ -1281,43 +1288,41 @@
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeConnectionCancel(packets::PacketView<true> args) {
+void DualModeController::HciLeConnectionCancel(PacketView<true> args) {
   ASSERT_LOG(args.size() == 0, "%s  size=%zu", __func__, args.size());
   link_layer_controller_.SetLeConnect(false);
   auto packet = bluetooth::hci::LeCreateConnectionCancelStatusBuilder::Create(
-      bluetooth::hci::ErrorCode::SUCCESS, kNumCommandPackets);
+      ErrorCode::SUCCESS, kNumCommandPackets);
   send_event_(std::move(packet));
   /* For testing Jakub's patch:  Figure out a neat way to call this without
      recompiling.  I'm thinking about a bad device. */
   /*
   SendCommandCompleteOnlyStatus(OpCode::LE_CREATE_CONNECTION_CANCEL,
-                                bluetooth::hci::ErrorCode::COMMAND_DISALLOWED);
+                                ErrorCode::COMMAND_DISALLOWED);
   */
 }
 
-void DualModeController::HciLeReadWhiteListSize(packets::PacketView<true> args) {
+void DualModeController::HciLeReadWhiteListSize(PacketView<true> args) {
   ASSERT_LOG(args.size() == 0, "%s  size=%zu", __func__, args.size());
   auto packet = bluetooth::hci::LeReadWhiteListSizeCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
-      properties_.GetLeWhiteListSize());
+      kNumCommandPackets, ErrorCode::SUCCESS, properties_.GetLeWhiteListSize());
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeClearWhiteList(packets::PacketView<true> args) {
+void DualModeController::HciLeClearWhiteList(PacketView<true> args) {
   ASSERT_LOG(args.size() == 0, "%s  size=%zu", __func__, args.size());
   link_layer_controller_.LeWhiteListClear();
   auto packet = bluetooth::hci::LeClearWhiteListCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeAddDeviceToWhiteList(packets::PacketView<true> args) {
+void DualModeController::HciLeAddDeviceToWhiteList(PacketView<true> args) {
   ASSERT_LOG(args.size() == 7, "%s  size=%zu", __func__, args.size());
 
   if (link_layer_controller_.LeWhiteListFull()) {
     auto packet = bluetooth::hci::LeAddDeviceToWhiteListCompleteBuilder::Create(
-        kNumCommandPackets,
-        bluetooth::hci::ErrorCode::MEMORY_CAPACITY_EXCEEDED);
+        kNumCommandPackets, ErrorCode::MEMORY_CAPACITY_EXCEEDED);
     send_event_(std::move(packet));
     return;
   }
@@ -1326,11 +1331,11 @@
   Address address = args_itr.extract<Address>();
   link_layer_controller_.LeWhiteListAddDevice(address, addr_type);
   auto packet = bluetooth::hci::LeAddDeviceToWhiteListCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeRemoveDeviceFromWhiteList(packets::PacketView<true> args) {
+void DualModeController::HciLeRemoveDeviceFromWhiteList(PacketView<true> args) {
   ASSERT_LOG(args.size() == 7, "%s  size=%zu", __func__, args.size());
 
   auto args_itr = args.begin();
@@ -1339,28 +1344,25 @@
   link_layer_controller_.LeWhiteListRemoveDevice(address, addr_type);
   auto packet =
       bluetooth::hci::LeRemoveDeviceFromWhiteListCompleteBuilder::Create(
-          kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+          kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeClearResolvingList(
-    packets::PacketView<true> args) {
+void DualModeController::HciLeClearResolvingList(PacketView<true> args) {
   ASSERT_LOG(args.size() == 0, "%s  size=%zu", __func__, args.size());
   link_layer_controller_.LeResolvingListClear();
   auto packet = bluetooth::hci::LeClearResolvingListCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeAddDeviceToResolvingList(
-    packets::PacketView<true> args) {
+void DualModeController::HciLeAddDeviceToResolvingList(PacketView<true> args) {
   ASSERT_LOG(args.size() == 39, "%s  size=%zu", __func__, args.size());
 
   if (link_layer_controller_.LeResolvingListFull()) {
     auto packet =
         bluetooth::hci::LeAddDeviceToResolvingListCompleteBuilder::Create(
-            kNumCommandPackets,
-            bluetooth::hci::ErrorCode::MEMORY_CAPACITY_EXCEEDED);
+            kNumCommandPackets, ErrorCode::MEMORY_CAPACITY_EXCEEDED);
     send_event_(std::move(packet));
     return;
   }
@@ -1383,12 +1385,12 @@
                                                   localIrk);
   auto packet =
       bluetooth::hci::LeAddDeviceToResolvingListCompleteBuilder::Create(
-          kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+          kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
 void DualModeController::HciLeRemoveDeviceFromResolvingList(
-    packets::PacketView<true> args) {
+    PacketView<true> args) {
   ASSERT_LOG(args.size() == 7, "%s  size=%zu", __func__, args.size());
 
   auto args_itr = args.begin();
@@ -1397,11 +1399,11 @@
   link_layer_controller_.LeResolvingListRemoveDevice(address, addr_type);
   auto packet =
       bluetooth::hci::LeRemoveDeviceFromResolvingListCompleteBuilder::Create(
-          kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+          kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeSetPrivacyMode(packets::PacketView<true> args) {
+void DualModeController::HciLeSetPrivacyMode(PacketView<true> args) {
   ASSERT_LOG(args.size() == 8, "%s  size=%zu", __func__, args.size());
 
   auto args_itr = args.begin();
@@ -1416,24 +1418,24 @@
   }
 
   auto packet = bluetooth::hci::LeSetPrivacyModeCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeReadRemoteFeatures(packets::PacketView<true> args) {
+void DualModeController::HciLeReadRemoteFeatures(PacketView<true> args) {
   ASSERT_LOG(args.size() == 2, "%s  size=%zu", __func__, args.size());
 
   uint16_t handle = args.begin().extract<uint16_t>();
 
   auto status = link_layer_controller_.SendCommandToRemoteByHandle(
-      bluetooth::hci::OpCode::LE_READ_REMOTE_FEATURES, args, handle);
+      OpCode::LE_READ_REMOTE_FEATURES, args, handle);
 
   auto packet = bluetooth::hci::LeConnectionUpdateStatusBuilder::Create(
       status, kNumCommandPackets);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeRand(packets::PacketView<true> args) {
+void DualModeController::HciLeRand(PacketView<true> args) {
   ASSERT_LOG(args.size() == 0, "%s  size=%zu", __func__, args.size());
   uint64_t random_val = 0;
   for (size_t rand_bytes = 0; rand_bytes < sizeof(uint64_t); rand_bytes += sizeof(RAND_MAX)) {
@@ -1441,64 +1443,63 @@
   }
 
   auto packet = bluetooth::hci::LeRandCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS, random_val);
+      kNumCommandPackets, ErrorCode::SUCCESS, random_val);
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeReadSupportedStates(packets::PacketView<true> args) {
+void DualModeController::HciLeReadSupportedStates(PacketView<true> args) {
   ASSERT_LOG(args.size() == 0, "%s  size=%zu", __func__, args.size());
   auto packet = bluetooth::hci::LeReadSupportedStatesCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
+      kNumCommandPackets, ErrorCode::SUCCESS,
       properties_.GetLeSupportedStates());
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeVendorCap(packets::PacketView<true> args) {
+void DualModeController::HciLeVendorCap(PacketView<true> args) {
   ASSERT_LOG(args.size() == 0, "%s  size=%zu", __func__, args.size());
   vector<uint8_t> caps = properties_.GetLeVendorCap();
   if (caps.size() == 0) {
-    SendCommandCompleteUnknownOpCodeEvent(static_cast<uint16_t>(
-        bluetooth::hci::OpCode::LE_GET_VENDOR_CAPABILITIES));
+    SendCommandCompleteUnknownOpCodeEvent(
+        static_cast<uint16_t>(OpCode::LE_GET_VENDOR_CAPABILITIES));
     return;
   }
 
   std::unique_ptr<bluetooth::packet::RawBuilder> raw_builder_ptr =
       std::make_unique<bluetooth::packet::RawBuilder>();
-  raw_builder_ptr->AddOctets1(
-      static_cast<uint8_t>(bluetooth::hci::ErrorCode::SUCCESS));
+  raw_builder_ptr->AddOctets1(static_cast<uint8_t>(ErrorCode::SUCCESS));
   raw_builder_ptr->AddOctets(properties_.GetLeVendorCap());
 
   auto packet = bluetooth::hci::CommandCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::OpCode::LE_GET_VENDOR_CAPABILITIES,
+      kNumCommandPackets, OpCode::LE_GET_VENDOR_CAPABILITIES,
       std::move(raw_builder_ptr));
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciLeVendorMultiAdv(packets::PacketView<true> args) {
+void DualModeController::HciLeVendorMultiAdv(PacketView<true> args) {
   ASSERT(args.size() > 0);
   SendCommandCompleteUnknownOpCodeEvent(
-      static_cast<uint16_t>(bluetooth::hci::OpCode::LE_MULTI_ADVT));
+      static_cast<uint16_t>(OpCode::LE_MULTI_ADVT));
 }
 
-void DualModeController::HciLeAdvertisingFilter(packets::PacketView<true> args) {
+void DualModeController::HciLeAdvertisingFilter(PacketView<true> args) {
   ASSERT(args.size() > 0);
   SendCommandCompleteUnknownOpCodeEvent(
-      static_cast<uint16_t>(bluetooth::hci::OpCode::LE_ADV_FILTER));
+      static_cast<uint16_t>(OpCode::LE_ADV_FILTER));
 }
 
-void DualModeController::HciLeEnergyInfo(packets::PacketView<true> args) {
+void DualModeController::HciLeEnergyInfo(PacketView<true> args) {
   ASSERT(args.size() > 0);
   SendCommandCompleteUnknownOpCodeEvent(
-      static_cast<uint16_t>(bluetooth::hci::OpCode::LE_ENERGY_INFO));
+      static_cast<uint16_t>(OpCode::LE_ENERGY_INFO));
 }
 
-void DualModeController::HciLeExtendedScanParams(packets::PacketView<true> args) {
+void DualModeController::HciLeExtendedScanParams(PacketView<true> args) {
   ASSERT(args.size() > 0);
   SendCommandCompleteUnknownOpCodeEvent(
-      static_cast<uint16_t>(bluetooth::hci::OpCode::LE_EXTENDED_SCAN_PARAMS));
+      static_cast<uint16_t>(OpCode::LE_EXTENDED_SCAN_PARAMS));
 }
 
-void DualModeController::HciLeStartEncryption(packets::PacketView<true> args) {
+void DualModeController::HciLeStartEncryption(PacketView<true> args) {
   ASSERT_LOG(args.size() == 28, "%s  size=%zu", __func__, args.size());
 
   auto args_itr = args.begin();
@@ -1510,12 +1511,11 @@
   //   long_term_key.push_back(args_itr.extract<uint18_t>();
   // }
   auto status_packet = bluetooth::hci::LeStartEncryptionStatusBuilder::Create(
-      bluetooth::hci::ErrorCode::SUCCESS, kNumCommandPackets);
+      ErrorCode::SUCCESS, kNumCommandPackets);
   send_event_(std::move(status_packet));
 
   auto complete_packet = bluetooth::hci::EncryptionChangeBuilder::Create(
-      bluetooth::hci::ErrorCode::SUCCESS, handle,
-      bluetooth::hci::EncryptionEnabled::OFF);
+      ErrorCode::SUCCESS, handle, bluetooth::hci::EncryptionEnabled::OFF);
   send_event_(std::move(complete_packet));
 #if 0
 
@@ -1571,31 +1571,31 @@
 #endif
 }
 
-void DualModeController::HciReadLoopbackMode(packets::PacketView<true> args) {
+void DualModeController::HciReadLoopbackMode(PacketView<true> args) {
   ASSERT_LOG(args.size() == 0, "%s size=%zu", __func__, args.size());
   auto packet = bluetooth::hci::ReadLoopbackModeCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS,
-      static_cast<bluetooth::hci::LoopbackMode>(loopback_mode_));
+      kNumCommandPackets, ErrorCode::SUCCESS,
+      static_cast<LoopbackMode>(loopback_mode_));
   send_event_(std::move(packet));
 }
 
-void DualModeController::HciWriteLoopbackMode(packets::PacketView<true> args) {
+void DualModeController::HciWriteLoopbackMode(PacketView<true> args) {
   ASSERT_LOG(args.size() == 1, "%s size=%zu", __func__, args.size());
-  loopback_mode_ = static_cast<hci::LoopbackMode>(args[0]);
+  loopback_mode_ = static_cast<LoopbackMode>(args[0]);
   // ACL channel
   uint16_t acl_handle = 0x123;
   auto packet_acl = bluetooth::hci::ConnectionCompleteBuilder::Create(
-      bluetooth::hci::ErrorCode::SUCCESS, acl_handle, properties_.GetAddress(),
+      ErrorCode::SUCCESS, acl_handle, properties_.GetAddress(),
       bluetooth::hci::LinkType::ACL, bluetooth::hci::Enable::DISABLED);
   send_event_(std::move(packet_acl));
   // SCO channel
   uint16_t sco_handle = 0x345;
   auto packet_sco = bluetooth::hci::ConnectionCompleteBuilder::Create(
-      bluetooth::hci::ErrorCode::SUCCESS, sco_handle, properties_.GetAddress(),
+      ErrorCode::SUCCESS, sco_handle, properties_.GetAddress(),
       bluetooth::hci::LinkType::SCO, bluetooth::hci::Enable::DISABLED);
   send_event_(std::move(packet_sco));
   auto packet = bluetooth::hci::WriteLoopbackModeCompleteBuilder::Create(
-      kNumCommandPackets, bluetooth::hci::ErrorCode::SUCCESS);
+      kNumCommandPackets, ErrorCode::SUCCESS);
   send_event_(std::move(packet));
 }
 
diff --git a/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.h b/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.h
index bd9c17d..b024cbb 100644
--- a/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.h
+++ b/vendor_libs/test_vendor_lib/model/controller/dual_mode_controller.h
@@ -34,6 +34,7 @@
 namespace test_vendor_lib {
 
 using ::bluetooth::hci::Address;
+using ::bluetooth::packet::PacketView;
 
 // Emulates a dual mode BR/EDR + LE controller by maintaining the link layer
 // state machine detailed in the Bluetooth Core Specification Version 4.2,
@@ -106,315 +107,315 @@
   // Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.1
 
   // 7.1.1
-  void HciInquiry(packets::PacketView<true> args);
+  void HciInquiry(PacketView<true> args);
 
   // 7.1.2
-  void HciInquiryCancel(packets::PacketView<true> args);
+  void HciInquiryCancel(PacketView<true> args);
 
   // 7.1.5
-  void HciCreateConnection(packets::PacketView<true> args);
+  void HciCreateConnection(PacketView<true> args);
 
   // 7.1.6
-  void HciDisconnect(packets::PacketView<true> args);
+  void HciDisconnect(PacketView<true> args);
 
   // 7.1.8
-  void HciAcceptConnectionRequest(packets::PacketView<true> args);
+  void HciAcceptConnectionRequest(PacketView<true> args);
 
   // 7.1.9
-  void HciRejectConnectionRequest(packets::PacketView<true> args);
+  void HciRejectConnectionRequest(PacketView<true> args);
 
   // 7.1.10
-  void HciLinkKeyRequestReply(packets::PacketView<true> args);
+  void HciLinkKeyRequestReply(PacketView<true> args);
 
   // 7.1.11
-  void HciLinkKeyRequestNegativeReply(packets::PacketView<true> args);
+  void HciLinkKeyRequestNegativeReply(PacketView<true> args);
 
   // 7.1.14
-  void HciChangeConnectionPacketType(packets::PacketView<true> args);
+  void HciChangeConnectionPacketType(PacketView<true> args);
 
   // 7.1.15
-  void HciAuthenticationRequested(packets::PacketView<true> args);
+  void HciAuthenticationRequested(PacketView<true> args);
 
   // 7.1.16
-  void HciSetConnectionEncryption(packets::PacketView<true> args);
+  void HciSetConnectionEncryption(PacketView<true> args);
 
   // 7.1.17
-  void HciChangeConnectionLinkKey(packets::PacketView<true> args);
+  void HciChangeConnectionLinkKey(PacketView<true> args);
 
   // 7.1.18
-  void HciMasterLinkKey(packets::PacketView<true> args);
+  void HciMasterLinkKey(PacketView<true> args);
 
   // 7.1.19
-  void HciRemoteNameRequest(packets::PacketView<true> args);
+  void HciRemoteNameRequest(PacketView<true> args);
 
   // 7.2.8
-  void HciSwitchRole(packets::PacketView<true> args);
+  void HciSwitchRole(PacketView<true> args);
 
   // 7.1.21
-  void HciReadRemoteSupportedFeatures(packets::PacketView<true> args);
+  void HciReadRemoteSupportedFeatures(PacketView<true> args);
 
   // 7.1.22
-  void HciReadRemoteExtendedFeatures(packets::PacketView<true> args);
+  void HciReadRemoteExtendedFeatures(PacketView<true> args);
 
   // 7.1.23
-  void HciReadRemoteVersionInformation(packets::PacketView<true> args);
+  void HciReadRemoteVersionInformation(PacketView<true> args);
 
   // 7.1.24
-  void HciReadClockOffset(packets::PacketView<true> args);
+  void HciReadClockOffset(PacketView<true> args);
 
   // 7.1.29
-  void HciIoCapabilityRequestReply(packets::PacketView<true> args);
+  void HciIoCapabilityRequestReply(PacketView<true> args);
 
   // 7.1.30
-  void HciUserConfirmationRequestReply(packets::PacketView<true> args);
+  void HciUserConfirmationRequestReply(PacketView<true> args);
 
   // 7.1.31
-  void HciUserConfirmationRequestNegativeReply(packets::PacketView<true> args);
+  void HciUserConfirmationRequestNegativeReply(PacketView<true> args);
 
   // 7.1.32
-  void HciUserPasskeyRequestReply(packets::PacketView<true> args);
+  void HciUserPasskeyRequestReply(PacketView<true> args);
 
   // 7.1.33
-  void HciUserPasskeyRequestNegativeReply(packets::PacketView<true> args);
+  void HciUserPasskeyRequestNegativeReply(PacketView<true> args);
 
   // 7.1.34
-  void HciRemoteOobDataRequestReply(packets::PacketView<true> args);
+  void HciRemoteOobDataRequestReply(PacketView<true> args);
 
   // 7.1.35
-  void HciRemoteOobDataRequestNegativeReply(packets::PacketView<true> args);
+  void HciRemoteOobDataRequestNegativeReply(PacketView<true> args);
 
   // 7.1.36
-  void HciIoCapabilityRequestNegativeReply(packets::PacketView<true> args);
+  void HciIoCapabilityRequestNegativeReply(PacketView<true> args);
 
   // Link Policy Commands
   // Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.2
 
   // 7.2.1
-  void HciHoldMode(packets::PacketView<true> args);
+  void HciHoldMode(PacketView<true> args);
 
   // 7.2.2
-  void HciSniffMode(packets::PacketView<true> args);
+  void HciSniffMode(PacketView<true> args);
 
   // 7.2.3
-  void HciExitSniffMode(packets::PacketView<true> args);
+  void HciExitSniffMode(PacketView<true> args);
 
   // 7.2.6
-  void HciQosSetup(packets::PacketView<true> args);
+  void HciQosSetup(PacketView<true> args);
 
   // 7.2.10
-  void HciWriteLinkPolicySettings(packets::PacketView<true> args);
+  void HciWriteLinkPolicySettings(PacketView<true> args);
 
   // 7.2.12
-  void HciWriteDefaultLinkPolicySettings(packets::PacketView<true> args);
+  void HciWriteDefaultLinkPolicySettings(PacketView<true> args);
 
   // 7.2.13
-  void HciFlowSpecification(packets::PacketView<true> args);
+  void HciFlowSpecification(PacketView<true> args);
 
   // 7.2.14
-  void HciSniffSubrating(packets::PacketView<true> args);
+  void HciSniffSubrating(PacketView<true> args);
 
   // Link Controller Commands
   // Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.3
 
   // 7.3.1
-  void HciSetEventMask(packets::PacketView<true> args);
+  void HciSetEventMask(PacketView<true> args);
 
   // 7.3.2
-  void HciReset(packets::PacketView<true> args);
+  void HciReset(PacketView<true> args);
 
   // 7.3.3
-  void HciSetEventFilter(packets::PacketView<true> args);
+  void HciSetEventFilter(PacketView<true> args);
 
   // 7.3.10
-  void HciDeleteStoredLinkKey(packets::PacketView<true> args);
+  void HciDeleteStoredLinkKey(PacketView<true> args);
 
   // 7.3.11
-  void HciWriteLocalName(packets::PacketView<true> args);
+  void HciWriteLocalName(PacketView<true> args);
 
   // 7.3.12
-  void HciReadLocalName(packets::PacketView<true> args);
+  void HciReadLocalName(PacketView<true> args);
 
   // 7.3.16
-  void HciWritePageTimeout(packets::PacketView<true> args);
+  void HciWritePageTimeout(PacketView<true> args);
 
   // 7.3.18
-  void HciWriteScanEnable(packets::PacketView<true> args);
+  void HciWriteScanEnable(PacketView<true> args);
 
   // 7.3.22
-  void HciWriteInquiryScanActivity(packets::PacketView<true> args);
+  void HciWriteInquiryScanActivity(PacketView<true> args);
 
   // 7.3.23
-  void HciReadAuthenticationEnable(packets::PacketView<true> args);
+  void HciReadAuthenticationEnable(PacketView<true> args);
 
   // 7.3.24
-  void HciWriteAuthenticationEnable(packets::PacketView<true> args);
+  void HciWriteAuthenticationEnable(PacketView<true> args);
 
   // 7.3.26
-  void HciWriteClassOfDevice(packets::PacketView<true> args);
+  void HciWriteClassOfDevice(PacketView<true> args);
 
   // 7.3.28
-  void HciWriteVoiceSetting(packets::PacketView<true> args);
+  void HciWriteVoiceSetting(PacketView<true> args);
 
   // 7.3.39
-  void HciHostBufferSize(packets::PacketView<true> args);
+  void HciHostBufferSize(PacketView<true> args);
 
   // 7.3.42
-  void HciWriteLinkSupervisionTimeout(packets::PacketView<true> args);
+  void HciWriteLinkSupervisionTimeout(PacketView<true> args);
 
   // 7.3.45
-  void HciWriteCurrentIacLap(packets::PacketView<true> args);
+  void HciWriteCurrentIacLap(PacketView<true> args);
 
   // 7.3.48
-  void HciWriteInquiryScanType(packets::PacketView<true> args);
+  void HciWriteInquiryScanType(PacketView<true> args);
 
   // 7.3.50
-  void HciWriteInquiryMode(packets::PacketView<true> args);
+  void HciWriteInquiryMode(PacketView<true> args);
 
   // 7.3.52
-  void HciWritePageScanType(packets::PacketView<true> args);
+  void HciWritePageScanType(PacketView<true> args);
 
   // 7.3.56
-  void HciWriteExtendedInquiryResponse(packets::PacketView<true> args);
+  void HciWriteExtendedInquiryResponse(PacketView<true> args);
 
   // 7.3.57
-  void HciRefreshEncryptionKey(packets::PacketView<true> args);
+  void HciRefreshEncryptionKey(PacketView<true> args);
 
   // 7.3.59
-  void HciWriteSimplePairingMode(packets::PacketView<true> args);
+  void HciWriteSimplePairingMode(PacketView<true> args);
 
   // 7.3.79
-  void HciWriteLeHostSupport(packets::PacketView<true> args);
+  void HciWriteLeHostSupport(PacketView<true> args);
 
   // 7.3.92
-  void HciWriteSecureConnectionsHostSupport(packets::PacketView<true> args);
+  void HciWriteSecureConnectionsHostSupport(PacketView<true> args);
 
   // Informational Parameters Commands
   // Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.4
 
   // 7.4.5
-  void HciReadBufferSize(packets::PacketView<true> args);
+  void HciReadBufferSize(PacketView<true> args);
 
   // 7.4.1
-  void HciReadLocalVersionInformation(packets::PacketView<true> args);
+  void HciReadLocalVersionInformation(PacketView<true> args);
 
   // 7.4.6
-  void HciReadBdAddr(packets::PacketView<true> args);
+  void HciReadBdAddr(PacketView<true> args);
 
   // 7.4.2
-  void HciReadLocalSupportedCommands(packets::PacketView<true> args);
+  void HciReadLocalSupportedCommands(PacketView<true> args);
 
   // 7.4.3
-  void HciReadLocalSupportedFeatures(packets::PacketView<true> args);
+  void HciReadLocalSupportedFeatures(PacketView<true> args);
 
   // 7.4.4
-  void HciReadLocalExtendedFeatures(packets::PacketView<true> args);
+  void HciReadLocalExtendedFeatures(PacketView<true> args);
 
   // 7.4.8
-  void HciReadLocalSupportedCodecs(packets::PacketView<true> args);
+  void HciReadLocalSupportedCodecs(PacketView<true> args);
 
   // Status Parameters Commands
   // Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.5
 
   // 7.5.7
-  void HciReadEncryptionKeySize(packets::PacketView<true> args);
+  void HciReadEncryptionKeySize(PacketView<true> args);
 
   // Test Commands
   // Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.7
 
   // 7.7.1
-  void HciReadLoopbackMode(packets::PacketView<true> args);
+  void HciReadLoopbackMode(PacketView<true> args);
 
   // 7.7.2
-  void HciWriteLoopbackMode(packets::PacketView<true> args);
+  void HciWriteLoopbackMode(PacketView<true> args);
 
   // LE Controller Commands
   // Bluetooth Core Specification Version 4.2 Volume 2 Part E 7.8
 
   // 7.8.1
-  void HciLeSetEventMask(packets::PacketView<true> args);
+  void HciLeSetEventMask(PacketView<true> args);
 
   // 7.8.2
-  void HciLeReadBufferSize(packets::PacketView<true> args);
+  void HciLeReadBufferSize(PacketView<true> args);
 
   // 7.8.3
-  void HciLeReadLocalSupportedFeatures(packets::PacketView<true> args);
+  void HciLeReadLocalSupportedFeatures(PacketView<true> args);
 
   // 7.8.4
-  void HciLeSetRandomAddress(packets::PacketView<true> args);
+  void HciLeSetRandomAddress(PacketView<true> args);
 
   // 7.8.5
-  void HciLeSetAdvertisingParameters(packets::PacketView<true> args);
+  void HciLeSetAdvertisingParameters(PacketView<true> args);
 
   // 7.8.7
-  void HciLeSetAdvertisingData(packets::PacketView<true> args);
+  void HciLeSetAdvertisingData(PacketView<true> args);
 
   // 7.8.8
-  void HciLeSetScanResponseData(packets::PacketView<true> args);
+  void HciLeSetScanResponseData(PacketView<true> args);
 
   // 7.8.9
-  void HciLeSetAdvertisingEnable(packets::PacketView<true> args);
+  void HciLeSetAdvertisingEnable(PacketView<true> args);
 
   // 7.8.10
-  void HciLeSetScanParameters(packets::PacketView<true> args);
+  void HciLeSetScanParameters(PacketView<true> args);
 
   // 7.8.11
-  void HciLeSetScanEnable(packets::PacketView<true> args);
+  void HciLeSetScanEnable(PacketView<true> args);
 
   // 7.8.12
-  void HciLeCreateConnection(packets::PacketView<true> args);
+  void HciLeCreateConnection(PacketView<true> args);
 
   // 7.8.18
-  void HciLeConnectionUpdate(packets::PacketView<true> args);
+  void HciLeConnectionUpdate(PacketView<true> args);
 
   // 7.8.13
-  void HciLeConnectionCancel(packets::PacketView<true> args);
+  void HciLeConnectionCancel(PacketView<true> args);
 
   // 7.8.14
-  void HciLeReadWhiteListSize(packets::PacketView<true> args);
+  void HciLeReadWhiteListSize(PacketView<true> args);
 
   // 7.8.15
-  void HciLeClearWhiteList(packets::PacketView<true> args);
+  void HciLeClearWhiteList(PacketView<true> args);
 
   // 7.8.16
-  void HciLeAddDeviceToWhiteList(packets::PacketView<true> args);
+  void HciLeAddDeviceToWhiteList(PacketView<true> args);
 
   // 7.8.17
-  void HciLeRemoveDeviceFromWhiteList(packets::PacketView<true> args);
+  void HciLeRemoveDeviceFromWhiteList(PacketView<true> args);
 
   // 7.8.21
-  void HciLeReadRemoteFeatures(packets::PacketView<true> args);
+  void HciLeReadRemoteFeatures(PacketView<true> args);
 
   // 7.8.23
-  void HciLeRand(packets::PacketView<true> args);
+  void HciLeRand(PacketView<true> args);
 
   // 7.8.24
-  void HciLeStartEncryption(packets::PacketView<true> args);
+  void HciLeStartEncryption(PacketView<true> args);
 
   // 7.8.27
-  void HciLeReadSupportedStates(packets::PacketView<true> args);
+  void HciLeReadSupportedStates(PacketView<true> args);
 
   // 7.8.38
-  void HciLeAddDeviceToResolvingList(packets::PacketView<true> args);
+  void HciLeAddDeviceToResolvingList(PacketView<true> args);
 
   // 7.8.39
-  void HciLeRemoveDeviceFromResolvingList(packets::PacketView<true> args);
+  void HciLeRemoveDeviceFromResolvingList(PacketView<true> args);
 
   // 7.8.40
-  void HciLeClearResolvingList(packets::PacketView<true> args);
+  void HciLeClearResolvingList(PacketView<true> args);
 
   // 7.8.77
-  void HciLeSetPrivacyMode(packets::PacketView<true> args);
+  void HciLeSetPrivacyMode(PacketView<true> args);
 
   // Vendor-specific Commands
 
-  void HciLeVendorSleepMode(packets::PacketView<true> args);
-  void HciLeVendorCap(packets::PacketView<true> args);
-  void HciLeVendorMultiAdv(packets::PacketView<true> args);
-  void HciLeVendor155(packets::PacketView<true> args);
-  void HciLeVendor157(packets::PacketView<true> args);
-  void HciLeEnergyInfo(packets::PacketView<true> args);
-  void HciLeAdvertisingFilter(packets::PacketView<true> args);
-  void HciLeExtendedScanParams(packets::PacketView<true> args);
+  void HciLeVendorSleepMode(PacketView<true> args);
+  void HciLeVendorCap(PacketView<true> args);
+  void HciLeVendorMultiAdv(PacketView<true> args);
+  void HciLeVendor155(PacketView<true> args);
+  void HciLeVendor157(PacketView<true> args);
+  void HciLeEnergyInfo(PacketView<true> args);
+  void HciLeAdvertisingFilter(PacketView<true> args);
+  void HciLeExtendedScanParams(PacketView<true> args);
 
   void SetTimerPeriod(std::chrono::milliseconds new_period);
   void StartTimer();
@@ -429,9 +430,6 @@
 
   void AddConnectionAction(const TaskCallback& callback, uint16_t handle);
 
-  // Creates a command complete event and sends it back to the HCI.
-  void SendCommandComplete(hci::OpCode command_opcode, const std::vector<uint8_t>& return_parameters) const;
-
   void SendCommandCompleteUnknownOpCodeEvent(uint16_t command_opcode) const;
 
   // Callbacks to send packets back to the HCI.
@@ -445,9 +443,10 @@
   // Maintains the commands to be registered and used in the HciHandler object.
   // Keys are command opcodes and values are the callbacks to handle each
   // command.
-  std::unordered_map<uint16_t, std::function<void(packets::PacketView<true>)>> active_hci_commands_;
+  std::unordered_map<uint16_t, std::function<void(PacketView<true>)>>
+      active_hci_commands_;
 
-  hci::LoopbackMode loopback_mode_;
+  bluetooth::hci::LoopbackMode loopback_mode_;
 
   SecurityManager security_manager_;
 
diff --git a/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.cc b/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.cc
index aebe621..8f0975d 100644
--- a/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.cc
+++ b/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.cc
@@ -16,17 +16,12 @@
 
 #include "link_layer_controller.h"
 
-#include "hci.h"
 #include "include/le_advertisement.h"
 #include "os/log.h"
-#include "packets/hci/command_packet_view.h"
-#include "packets/raw_builder.h"
-
 #include "packet/raw_builder.h"
 
 using std::vector;
 using namespace std::chrono;
-using namespace test_vendor_lib::packets;
 
 namespace test_vendor_lib {
 
@@ -60,64 +55,64 @@
   });
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::SendCommandToRemoteByAddress(
-    bluetooth::hci::OpCode opcode, PacketView<true> args,
+ErrorCode LinkLayerController::SendCommandToRemoteByAddress(
+    OpCode opcode, bluetooth::packet::PacketView<true> args,
     const Address& remote) {
   Address local_address = properties_.GetAddress();
 
   switch (opcode) {
-    case (bluetooth::hci::OpCode::REMOTE_NAME_REQUEST):
+    case (OpCode::REMOTE_NAME_REQUEST):
       // LMP features get requested with remote name requests.
       SendLinkLayerPacket(model::packets::ReadRemoteLmpFeaturesBuilder::Create(
           local_address, remote));
       SendLinkLayerPacket(model::packets::RemoteNameRequestBuilder::Create(
           local_address, remote));
       break;
-    case (bluetooth::hci::OpCode::READ_REMOTE_SUPPORTED_FEATURES):
+    case (OpCode::READ_REMOTE_SUPPORTED_FEATURES):
       SendLinkLayerPacket(
           model::packets::ReadRemoteSupportedFeaturesBuilder::Create(
               local_address, remote));
       break;
-    case (bluetooth::hci::OpCode::READ_REMOTE_EXTENDED_FEATURES): {
+    case (OpCode::READ_REMOTE_EXTENDED_FEATURES): {
       uint8_t page_number =
           (args.begin() + 2).extract<uint8_t>();  // skip the handle
       SendLinkLayerPacket(
           model::packets::ReadRemoteExtendedFeaturesBuilder::Create(
               local_address, remote, page_number));
     } break;
-    case (bluetooth::hci::OpCode::READ_REMOTE_VERSION_INFORMATION):
+    case (OpCode::READ_REMOTE_VERSION_INFORMATION):
       SendLinkLayerPacket(
           model::packets::ReadRemoteVersionInformationBuilder::Create(
               local_address, remote));
       break;
-    case (bluetooth::hci::OpCode::READ_CLOCK_OFFSET):
+    case (OpCode::READ_CLOCK_OFFSET):
       SendLinkLayerPacket(model::packets::ReadClockOffsetBuilder::Create(
           local_address, remote));
       break;
     default:
       LOG_INFO("Dropping unhandled command 0x%04x",
                static_cast<uint16_t>(opcode));
-      return bluetooth::hci::ErrorCode::UNKNOWN_HCI_COMMAND;
+      return ErrorCode::UNKNOWN_HCI_COMMAND;
   }
 
-  return bluetooth::hci::ErrorCode::SUCCESS;
+  return ErrorCode::SUCCESS;
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::SendCommandToRemoteByHandle(
-    bluetooth::hci::OpCode opcode, PacketView<true> args, uint16_t handle) {
+ErrorCode LinkLayerController::SendCommandToRemoteByHandle(
+    OpCode opcode, bluetooth::packet::PacketView<true> args, uint16_t handle) {
   // TODO: Handle LE connections
   if (!connections_.HasHandle(handle)) {
-    return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+    return ErrorCode::UNKNOWN_CONNECTION;
   }
   return SendCommandToRemoteByAddress(opcode, args,
                                       connections_.GetAddress(handle));
 }
 
-hci::Status LinkLayerController::SendAclToRemote(
+ErrorCode LinkLayerController::SendAclToRemote(
     bluetooth::hci::AclPacketView acl_packet) {
   uint16_t handle = acl_packet.GetHandle();
   if (!connections_.HasHandle(handle)) {
-    return hci::Status::UNKNOWN_CONNECTION;
+    return ErrorCode::UNKNOWN_CONNECTION;
   }
 
   Address my_address = properties_.GetAddress();
@@ -158,7 +153,7 @@
       my_address, destination, std::move(raw_builder_ptr));
 
   SendLinkLayerPacket(std::move(acl));
-  return hci::Status::SUCCESS;
+  return ErrorCode::SUCCESS;
 }
 
 void LinkLayerController::IncomingPacket(
@@ -325,8 +320,7 @@
   ASSERT(view.IsValid());
 
   send_event_(bluetooth::hci::RemoteNameRequestCompleteBuilder::Create(
-      bluetooth::hci::ErrorCode::SUCCESS, packet.GetSourceAddress(),
-      view.GetName()));
+      ErrorCode::SUCCESS, packet.GetSourceAddress(), view.GetName()));
 }
 
 void LinkLayerController::IncomingReadRemoteLmpFeatures(
@@ -364,7 +358,7 @@
     uint16_t handle = connections_.GetHandle(source);
     send_event_(
         bluetooth::hci::ReadRemoteSupportedFeaturesCompleteBuilder::Create(
-            bluetooth::hci::ErrorCode::SUCCESS, handle, view.GetFeatures()));
+            ErrorCode::SUCCESS, handle, view.GetFeatures()));
   } else {
     LOG_INFO("Discarding response from a disconnected device %s",
              source.ToString().c_str());
@@ -376,10 +370,9 @@
   auto view = model::packets::ReadRemoteExtendedFeaturesView::Create(packet);
   ASSERT(view.IsValid());
   uint8_t page_number = view.GetPageNumber();
-  uint8_t error_code = static_cast<uint8_t>(bluetooth::hci::ErrorCode::SUCCESS);
+  uint8_t error_code = static_cast<uint8_t>(ErrorCode::SUCCESS);
   if (page_number > properties_.GetExtendedFeaturesMaximumPageNumber()) {
-    error_code = static_cast<uint8_t>(
-        bluetooth::hci::ErrorCode::INVALID_LMP_OR_LL_PARAMETERS);
+    error_code = static_cast<uint8_t>(ErrorCode::INVALID_LMP_OR_LL_PARAMETERS);
   }
   SendLinkLayerPacket(
       model::packets::ReadRemoteExtendedFeaturesResponseBuilder::Create(
@@ -398,7 +391,7 @@
     uint16_t handle = connections_.GetHandle(packet.GetSourceAddress());
     send_event_(
         bluetooth::hci::ReadRemoteExtendedFeaturesCompleteBuilder::Create(
-            static_cast<bluetooth::hci::ErrorCode>(view.GetStatus()), handle,
+            static_cast<ErrorCode>(view.GetStatus()), handle,
             view.GetPageNumber(), view.GetMaxPageNumber(), view.GetFeatures()));
   } else {
     LOG_INFO("Discarding response from a disconnected device %s",
@@ -424,7 +417,7 @@
     uint16_t handle = connections_.GetHandle(packet.GetSourceAddress());
     send_event_(
         bluetooth::hci::ReadRemoteVersionInformationCompleteBuilder::Create(
-            bluetooth::hci::ErrorCode::SUCCESS, handle, view.GetLmpVersion(),
+            ErrorCode::SUCCESS, handle, view.GetLmpVersion(),
             view.GetManufacturerName(), view.GetLmpSubversion()));
   } else {
     LOG_INFO("Discarding response from a disconnected device %s",
@@ -447,7 +440,7 @@
   if (connections_.IsDeviceConnected(source)) {
     uint16_t handle = connections_.GetHandle(packet.GetSourceAddress());
     send_event_(bluetooth::hci::ReadClockOffsetCompleteBuilder::Create(
-        bluetooth::hci::ErrorCode::SUCCESS, handle, view.GetOffset()));
+        ErrorCode::SUCCESS, handle, view.GetOffset()));
   } else {
     LOG_INFO("Discarding response from a disconnected device %s",
              source.ToString().c_str());
@@ -484,8 +477,7 @@
     return;
   }
   send_event_(bluetooth::hci::EncryptionChangeBuilder::Create(
-      bluetooth::hci::ErrorCode::SUCCESS, handle,
-      bluetooth::hci::EncryptionEnabled::ON));
+      ErrorCode::SUCCESS, handle, bluetooth::hci::EncryptionEnabled::ON));
 
   uint16_t count = security_manager_.ReadKey(peer);
   if (count == 0) {
@@ -509,8 +501,7 @@
     return;
   }
   auto packet = bluetooth::hci::EncryptionChangeBuilder::Create(
-      bluetooth::hci::ErrorCode::SUCCESS, handle,
-      bluetooth::hci::EncryptionEnabled::ON);
+      ErrorCode::SUCCESS, handle, bluetooth::hci::EncryptionEnabled::ON);
   send_event_(std::move(packet));
 }
 
@@ -780,8 +771,7 @@
     return;
   }
   auto packet = bluetooth::hci::LeConnectionCompleteBuilder::Create(
-      bluetooth::hci::ErrorCode::SUCCESS, handle,
-      static_cast<bluetooth::hci::Role>(role),
+      ErrorCode::SUCCESS, handle, static_cast<bluetooth::hci::Role>(role),
       static_cast<bluetooth::hci::AddressType>(address_type), address,
       connection_interval, connection_latency, supervision_timeout,
       static_cast<bluetooth::hci::MasterClockAccuracy>(0x00));
@@ -799,10 +789,13 @@
              incoming.GetSourceAddress().ToString().c_str(), connect.GetAddressType());
     return;
   }
-  HandleLeConnection(incoming.GetSourceAddress(), static_cast<uint8_t>(connect.GetAddressType()),
-                     static_cast<uint8_t>(properties_.GetLeAdvertisingOwnAddressType()),
-                     static_cast<uint8_t>(hci::Role::SLAVE), connection_interval, connect.GetLeConnectionLatency(),
-                     connect.GetLeConnectionSupervisionTimeout());
+  HandleLeConnection(
+      incoming.GetSourceAddress(),
+      static_cast<uint8_t>(connect.GetAddressType()),
+      static_cast<uint8_t>(properties_.GetLeAdvertisingOwnAddressType()),
+      static_cast<uint8_t>(bluetooth::hci::Role::SLAVE), connection_interval,
+      connect.GetLeConnectionLatency(),
+      connect.GetLeConnectionSupervisionTimeout());
 
   auto to_send = model::packets::LeConnectCompleteBuilder::Create(
       incoming.GetDestinationAddress(), incoming.GetSourceAddress(),
@@ -816,9 +809,12 @@
     model::packets::LinkLayerPacketView incoming) {
   auto complete = model::packets::LeConnectCompleteView::Create(incoming);
   ASSERT(complete.IsValid());
-  HandleLeConnection(incoming.GetSourceAddress(), static_cast<uint8_t>(complete.GetAddressType()),
-                     static_cast<uint8_t>(le_address_type_), static_cast<uint8_t>(hci::Role::MASTER),
-                     complete.GetLeConnectionInterval(), complete.GetLeConnectionLatency(),
+  HandleLeConnection(incoming.GetSourceAddress(),
+                     static_cast<uint8_t>(complete.GetAddressType()),
+                     static_cast<uint8_t>(le_address_type_),
+                     static_cast<uint8_t>(bluetooth::hci::Role::MASTER),
+                     complete.GetLeConnectionInterval(),
+                     complete.GetLeConnectionLatency(),
                      complete.GetLeConnectionSupervisionTimeout());
 }
 
@@ -893,7 +889,7 @@
   ASSERT(reject.IsValid());
   LOG_INFO("%s: Sending CreateConnectionComplete", __func__);
   auto packet = bluetooth::hci::ConnectionCompleteBuilder::Create(
-      static_cast<bluetooth::hci::ErrorCode>(reject.GetReason()), 0x0eff,
+      static_cast<ErrorCode>(reject.GetReason()), 0x0eff,
       incoming.GetSourceAddress(), bluetooth::hci::LinkType::ACL,
       bluetooth::hci::Enable::DISABLED);
   send_event_(std::move(packet));
@@ -910,7 +906,7 @@
     return;
   }
   auto packet = bluetooth::hci::ConnectionCompleteBuilder::Create(
-      bluetooth::hci::ErrorCode::SUCCESS, handle, incoming.GetSourceAddress(),
+      ErrorCode::SUCCESS, handle, incoming.GetSourceAddress(),
       bluetooth::hci::LinkType::ACL, bluetooth::hci::Enable::DISABLED);
   send_event_(std::move(packet));
 
@@ -1070,37 +1066,37 @@
   ASSERT(security_manager_.GetAuthenticationAddress() == peer);
   // Check key in security_manager_ ?
   auto packet = bluetooth::hci::AuthenticationCompleteBuilder::Create(
-      bluetooth::hci::ErrorCode::SUCCESS, handle);
+      ErrorCode::SUCCESS, handle);
   send_event_(std::move(packet));
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::LinkKeyRequestReply(
+ErrorCode LinkLayerController::LinkKeyRequestReply(
     const Address& peer, const std::array<uint8_t, 16>& key) {
   security_manager_.WriteKey(peer, key);
   security_manager_.AuthenticationRequestFinished();
 
   ScheduleTask(milliseconds(5), [this, peer]() { AuthenticateRemoteStage2(peer); });
 
-  return bluetooth::hci::ErrorCode::SUCCESS;
+  return ErrorCode::SUCCESS;
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::LinkKeyRequestNegativeReply(
+ErrorCode LinkLayerController::LinkKeyRequestNegativeReply(
     const Address& address) {
   security_manager_.DeleteKey(address);
   // Simple pairing to get a key
   uint16_t handle = connections_.GetHandle(address);
   if (handle == acl::kReservedHandle) {
     LOG_INFO("%s: Device not connected %s", __func__, address.ToString().c_str());
-    return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+    return ErrorCode::UNKNOWN_CONNECTION;
   }
 
   security_manager_.AuthenticationRequest(address, handle);
 
   ScheduleTask(milliseconds(5), [this, address]() { StartSimplePairing(address); });
-  return bluetooth::hci::ErrorCode::SUCCESS;
+  return ErrorCode::SUCCESS;
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::IoCapabilityRequestReply(
+ErrorCode LinkLayerController::IoCapabilityRequestReply(
     const Address& peer, uint8_t io_capability, uint8_t oob_data_present_flag,
     uint8_t authentication_requirements) {
   security_manager_.SetLocalIoCapability(peer, io_capability, oob_data_present_flag, authentication_requirements);
@@ -1122,13 +1118,13 @@
         authentication_requirements));
   }
 
-  return bluetooth::hci::ErrorCode::SUCCESS;
+  return ErrorCode::SUCCESS;
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::IoCapabilityRequestNegativeReply(
-    const Address& peer, hci::Status reason) {
+ErrorCode LinkLayerController::IoCapabilityRequestNegativeReply(
+    const Address& peer, ErrorCode reason) {
   if (security_manager_.GetAuthenticationAddress() != peer) {
-    return bluetooth::hci::ErrorCode::AUTHENTICATION_FAILURE;
+    return ErrorCode::AUTHENTICATION_FAILURE;
   }
 
   security_manager_.InvalidateIoCapabilities();
@@ -1137,13 +1133,13 @@
       properties_.GetAddress(), peer, static_cast<uint8_t>(reason));
   SendLinkLayerPacket(std::move(packet));
 
-  return bluetooth::hci::ErrorCode::SUCCESS;
+  return ErrorCode::SUCCESS;
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::UserConfirmationRequestReply(
+ErrorCode LinkLayerController::UserConfirmationRequestReply(
     const Address& peer) {
   if (security_manager_.GetAuthenticationAddress() != peer) {
-    return bluetooth::hci::ErrorCode::AUTHENTICATION_FAILURE;
+    return ErrorCode::AUTHENTICATION_FAILURE;
   }
   // TODO: Key could be calculated here.
   std::array<uint8_t, 16> key_vec{1, 2,  3,  4,  5,  6,  7,  8,
@@ -1159,50 +1155,50 @@
 
   ScheduleTask(milliseconds(15),
                [this, peer]() { AuthenticateRemoteStage2(peer); });
-  return bluetooth::hci::ErrorCode::SUCCESS;
+  return ErrorCode::SUCCESS;
 }
 
-bluetooth::hci::ErrorCode
-LinkLayerController::UserConfirmationRequestNegativeReply(const Address& peer) {
-  if (security_manager_.GetAuthenticationAddress() != peer) {
-    return bluetooth::hci::ErrorCode::AUTHENTICATION_FAILURE;
-  }
-  return bluetooth::hci::ErrorCode::SUCCESS;
-}
-
-bluetooth::hci::ErrorCode LinkLayerController::UserPasskeyRequestReply(
-    const Address& peer, uint32_t numeric_value) {
-  if (security_manager_.GetAuthenticationAddress() != peer) {
-    return bluetooth::hci::ErrorCode::AUTHENTICATION_FAILURE;
-  }
-  LOG_INFO("TODO:Do something with the passkey %06d", numeric_value);
-  return bluetooth::hci::ErrorCode::SUCCESS;
-}
-
-bluetooth::hci::ErrorCode LinkLayerController::UserPasskeyRequestNegativeReply(
+ErrorCode LinkLayerController::UserConfirmationRequestNegativeReply(
     const Address& peer) {
   if (security_manager_.GetAuthenticationAddress() != peer) {
-    return bluetooth::hci::ErrorCode::AUTHENTICATION_FAILURE;
+    return ErrorCode::AUTHENTICATION_FAILURE;
   }
-  return bluetooth::hci::ErrorCode::SUCCESS;
+  return ErrorCode::SUCCESS;
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::RemoteOobDataRequestReply(
+ErrorCode LinkLayerController::UserPasskeyRequestReply(const Address& peer,
+                                                       uint32_t numeric_value) {
+  if (security_manager_.GetAuthenticationAddress() != peer) {
+    return ErrorCode::AUTHENTICATION_FAILURE;
+  }
+  LOG_INFO("TODO:Do something with the passkey %06d", numeric_value);
+  return ErrorCode::SUCCESS;
+}
+
+ErrorCode LinkLayerController::UserPasskeyRequestNegativeReply(
+    const Address& peer) {
+  if (security_manager_.GetAuthenticationAddress() != peer) {
+    return ErrorCode::AUTHENTICATION_FAILURE;
+  }
+  return ErrorCode::SUCCESS;
+}
+
+ErrorCode LinkLayerController::RemoteOobDataRequestReply(
     const Address& peer, const std::vector<uint8_t>& c,
     const std::vector<uint8_t>& r) {
   if (security_manager_.GetAuthenticationAddress() != peer) {
-    return bluetooth::hci::ErrorCode::AUTHENTICATION_FAILURE;
+    return ErrorCode::AUTHENTICATION_FAILURE;
   }
   LOG_INFO("TODO:Do something with the OOB data c=%d r=%d", c[0], r[0]);
-  return bluetooth::hci::ErrorCode::SUCCESS;
+  return ErrorCode::SUCCESS;
 }
 
-bluetooth::hci::ErrorCode
-LinkLayerController::RemoteOobDataRequestNegativeReply(const Address& peer) {
+ErrorCode LinkLayerController::RemoteOobDataRequestNegativeReply(
+    const Address& peer) {
   if (security_manager_.GetAuthenticationAddress() != peer) {
-    return bluetooth::hci::ErrorCode::AUTHENTICATION_FAILURE;
+    return ErrorCode::AUTHENTICATION_FAILURE;
   }
-  return bluetooth::hci::ErrorCode::SUCCESS;
+  return ErrorCode::SUCCESS;
 }
 
 void LinkLayerController::HandleAuthenticationRequest(const Address& address, uint16_t handle) {
@@ -1213,23 +1209,22 @@
   } else {  // Should never happen for our phones
     // Check for a key, try to authenticate, ask for a PIN.
     auto packet = bluetooth::hci::AuthenticationCompleteBuilder::Create(
-        bluetooth::hci::ErrorCode::AUTHENTICATION_FAILURE, handle);
+        ErrorCode::AUTHENTICATION_FAILURE, handle);
     send_event_(std::move(packet));
   }
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::AuthenticationRequested(
-    uint16_t handle) {
+ErrorCode LinkLayerController::AuthenticationRequested(uint16_t handle) {
   if (!connections_.HasHandle(handle)) {
     LOG_INFO("Authentication Requested for unknown handle %04x", handle);
-    return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+    return ErrorCode::UNKNOWN_CONNECTION;
   }
 
   Address remote = connections_.GetAddress(handle);
 
   ScheduleTask(milliseconds(5), [this, remote, handle]() { HandleAuthenticationRequest(remote, handle); });
 
-  return bluetooth::hci::ErrorCode::SUCCESS;
+  return ErrorCode::SUCCESS;
 }
 
 void LinkLayerController::HandleSetConnectionEncryption(const Address& peer, uint16_t handle,
@@ -1238,7 +1233,7 @@
 
   if (connections_.IsEncrypted(handle) && encryption_enable) {
     auto packet = bluetooth::hci::EncryptionChangeBuilder::Create(
-        bluetooth::hci::ErrorCode::SUCCESS, handle,
+        ErrorCode::SUCCESS, handle,
         static_cast<bluetooth::hci::EncryptionEnabled>(encryption_enable));
     send_event_(std::move(packet));
     return;
@@ -1256,33 +1251,33 @@
   SendLinkLayerPacket(std::move(packet));
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::SetConnectionEncryption(
+ErrorCode LinkLayerController::SetConnectionEncryption(
     uint16_t handle, uint8_t encryption_enable) {
   if (!connections_.HasHandle(handle)) {
     LOG_INFO("Set Connection Encryption for unknown handle %04x", handle);
-    return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+    return ErrorCode::UNKNOWN_CONNECTION;
   }
 
   if (connections_.IsEncrypted(handle) && !encryption_enable) {
-    return bluetooth::hci::ErrorCode::ENCRYPTION_MODE_NOT_ACCEPTABLE;
+    return ErrorCode::ENCRYPTION_MODE_NOT_ACCEPTABLE;
   }
   Address remote = connections_.GetAddress(handle);
 
   if (security_manager_.ReadKey(remote) == 0) {
-    return bluetooth::hci::ErrorCode::PIN_OR_KEY_MISSING;
+    return ErrorCode::PIN_OR_KEY_MISSING;
   }
 
   ScheduleTask(milliseconds(5), [this, remote, handle, encryption_enable]() {
     HandleSetConnectionEncryption(remote, handle, encryption_enable);
   });
-  return bluetooth::hci::ErrorCode::SUCCESS;
+  return ErrorCode::SUCCESS;
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::AcceptConnectionRequest(
-    const Address& addr, bool try_role_switch) {
+ErrorCode LinkLayerController::AcceptConnectionRequest(const Address& addr,
+                                                       bool try_role_switch) {
   if (!connections_.HasPendingConnection(addr)) {
     LOG_INFO("%s: No pending connection for %s", __func__, addr.ToString().c_str());
-    return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+    return ErrorCode::UNKNOWN_CONNECTION;
   }
 
   LOG_INFO("%s: Accept in 200ms", __func__);
@@ -1291,7 +1286,7 @@
     MakeSlaveConnection(addr, try_role_switch);
   });
 
-  return bluetooth::hci::ErrorCode::SUCCESS;
+  return ErrorCode::SUCCESS;
 }
 
 void LinkLayerController::MakeSlaveConnection(const Address& addr, bool try_role_switch) {
@@ -1307,22 +1302,22 @@
   }
   LOG_INFO("%s CreateConnection returned handle 0x%x", __func__, handle);
   auto packet = bluetooth::hci::ConnectionCompleteBuilder::Create(
-      bluetooth::hci::ErrorCode::SUCCESS, handle, addr,
-      bluetooth::hci::LinkType::ACL, bluetooth::hci::Enable::DISABLED);
+      ErrorCode::SUCCESS, handle, addr, bluetooth::hci::LinkType::ACL,
+      bluetooth::hci::Enable::DISABLED);
   send_event_(std::move(packet));
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::RejectConnectionRequest(
-    const Address& addr, uint8_t reason) {
+ErrorCode LinkLayerController::RejectConnectionRequest(const Address& addr,
+                                                       uint8_t reason) {
   if (!connections_.HasPendingConnection(addr)) {
     LOG_INFO("%s: No pending connection for %s", __func__, addr.ToString().c_str());
-    return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+    return ErrorCode::UNKNOWN_CONNECTION;
   }
 
   ScheduleTask(milliseconds(200),
                [this, addr, reason]() { RejectSlaveConnection(addr, reason); });
 
-  return bluetooth::hci::ErrorCode::SUCCESS;
+  return ErrorCode::SUCCESS;
 }
 
 void LinkLayerController::RejectSlaveConnection(const Address& addr, uint8_t reason) {
@@ -1333,39 +1328,37 @@
   SendLinkLayerPacket(std::move(to_send));
 
   auto packet = bluetooth::hci::ConnectionCompleteBuilder::Create(
-      static_cast<bluetooth::hci::ErrorCode>(reason), 0xeff, addr,
+      static_cast<ErrorCode>(reason), 0xeff, addr,
       bluetooth::hci::LinkType::ACL, bluetooth::hci::Enable::DISABLED);
   send_event_(std::move(packet));
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::CreateConnection(
-    const Address& addr, uint16_t, uint8_t, uint16_t,
-    uint8_t allow_role_switch) {
+ErrorCode LinkLayerController::CreateConnection(const Address& addr, uint16_t,
+                                                uint8_t, uint16_t,
+                                                uint8_t allow_role_switch) {
   if (!connections_.CreatePendingConnection(
           addr, properties_.GetAuthenticationEnable() == 1)) {
-    return bluetooth::hci::ErrorCode::CONTROLLER_BUSY;
+    return ErrorCode::CONTROLLER_BUSY;
   }
   auto page = model::packets::PageBuilder::Create(
       properties_.GetAddress(), addr, properties_.GetClassOfDevice(),
       allow_role_switch);
   SendLinkLayerPacket(std::move(page));
 
-  return bluetooth::hci::ErrorCode::SUCCESS;
+  return ErrorCode::SUCCESS;
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::CreateConnectionCancel(
-    const Address& addr) {
+ErrorCode LinkLayerController::CreateConnectionCancel(const Address& addr) {
   if (!connections_.CancelPendingConnection(addr)) {
-    return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+    return ErrorCode::UNKNOWN_CONNECTION;
   }
-  return bluetooth::hci::ErrorCode::SUCCESS;
+  return ErrorCode::SUCCESS;
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::Disconnect(uint16_t handle,
-                                                          uint8_t reason) {
+ErrorCode LinkLayerController::Disconnect(uint16_t handle, uint8_t reason) {
   // TODO: Handle LE
   if (!connections_.HasHandle(handle)) {
-    return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+    return ErrorCode::UNKNOWN_CONNECTION;
   }
 
   const Address& remote = connections_.GetAddress(handle);
@@ -1375,144 +1368,146 @@
   ASSERT_LOG(connections_.Disconnect(handle), "Disconnecting %hx", handle);
 
   ScheduleTask(milliseconds(20), [this, handle]() {
-    DisconnectCleanup(handle, static_cast<uint8_t>(hci::Status::CONNECTION_TERMINATED_BY_LOCAL_HOST));
+    DisconnectCleanup(
+        handle,
+        static_cast<uint8_t>(ErrorCode::CONNECTION_TERMINATED_BY_LOCAL_HOST));
   });
 
-  return bluetooth::hci::ErrorCode::SUCCESS;
+  return ErrorCode::SUCCESS;
 }
 
 void LinkLayerController::DisconnectCleanup(uint16_t handle, uint8_t reason) {
   // TODO: Clean up other connection state.
   auto packet = bluetooth::hci::DisconnectionCompleteBuilder::Create(
-      bluetooth::hci::ErrorCode::SUCCESS, handle,
-      static_cast<bluetooth::hci::ErrorCode>(reason));
+      ErrorCode::SUCCESS, handle, static_cast<ErrorCode>(reason));
   send_event_(std::move(packet));
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::ChangeConnectionPacketType(
-    uint16_t handle, uint16_t types) {
+ErrorCode LinkLayerController::ChangeConnectionPacketType(uint16_t handle,
+                                                          uint16_t types) {
   if (!connections_.HasHandle(handle)) {
-    return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+    return ErrorCode::UNKNOWN_CONNECTION;
   }
   auto packet = bluetooth::hci::ConnectionPacketTypeChangedBuilder::Create(
-      bluetooth::hci::ErrorCode::SUCCESS, handle, types);
+      ErrorCode::SUCCESS, handle, types);
   std::shared_ptr<bluetooth::hci::ConnectionPacketTypeChangedBuilder>
       shared_packet = std::move(packet);
   ScheduleTask(milliseconds(20), [this, shared_packet]() {
     send_event_(std::move(shared_packet));
   });
 
-  return bluetooth::hci::ErrorCode::SUCCESS;
+  return ErrorCode::SUCCESS;
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::ChangeConnectionLinkKey(
-    uint16_t handle) {
+ErrorCode LinkLayerController::ChangeConnectionLinkKey(uint16_t handle) {
   if (!connections_.HasHandle(handle)) {
-    return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+    return ErrorCode::UNKNOWN_CONNECTION;
   }
 
   // TODO: implement real logic
-  return bluetooth::hci::ErrorCode::COMMAND_DISALLOWED;
+  return ErrorCode::COMMAND_DISALLOWED;
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::MasterLinkKey(
-    uint8_t /* key_flag */) {
+ErrorCode LinkLayerController::MasterLinkKey(uint8_t /* key_flag */) {
   // TODO: implement real logic
-  return bluetooth::hci::ErrorCode::COMMAND_DISALLOWED;
+  return ErrorCode::COMMAND_DISALLOWED;
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::HoldMode(
-    uint16_t handle, uint16_t hold_mode_max_interval,
-    uint16_t hold_mode_min_interval) {
+ErrorCode LinkLayerController::HoldMode(uint16_t handle,
+                                        uint16_t hold_mode_max_interval,
+                                        uint16_t hold_mode_min_interval) {
   if (!connections_.HasHandle(handle)) {
-    return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+    return ErrorCode::UNKNOWN_CONNECTION;
   }
 
   if (hold_mode_max_interval < hold_mode_min_interval) {
-    return bluetooth::hci::ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
+    return ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
   }
 
   // TODO: implement real logic
-  return bluetooth::hci::ErrorCode::COMMAND_DISALLOWED;
+  return ErrorCode::COMMAND_DISALLOWED;
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::SniffMode(
-    uint16_t handle, uint16_t sniff_max_interval, uint16_t sniff_min_interval,
-    uint16_t sniff_attempt, uint16_t sniff_timeout) {
+ErrorCode LinkLayerController::SniffMode(uint16_t handle,
+                                         uint16_t sniff_max_interval,
+                                         uint16_t sniff_min_interval,
+                                         uint16_t sniff_attempt,
+                                         uint16_t sniff_timeout) {
   if (!connections_.HasHandle(handle)) {
-    return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+    return ErrorCode::UNKNOWN_CONNECTION;
   }
 
   if (sniff_max_interval < sniff_min_interval || sniff_attempt < 0x0001 || sniff_attempt > 0x7FFF ||
       sniff_timeout > 0x7FFF) {
-    return bluetooth::hci::ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
+    return ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
   }
 
   // TODO: implement real logic
-  return bluetooth::hci::ErrorCode::COMMAND_DISALLOWED;
+  return ErrorCode::COMMAND_DISALLOWED;
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::ExitSniffMode(uint16_t handle) {
+ErrorCode LinkLayerController::ExitSniffMode(uint16_t handle) {
   if (!connections_.HasHandle(handle)) {
-    return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+    return ErrorCode::UNKNOWN_CONNECTION;
   }
 
   // TODO: implement real logic
-  return bluetooth::hci::ErrorCode::COMMAND_DISALLOWED;
+  return ErrorCode::COMMAND_DISALLOWED;
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::QosSetup(
-    uint16_t handle, uint8_t service_type, uint32_t /* token_rate */,
-    uint32_t /* peak_bandwidth */, uint32_t /* latency */,
-    uint32_t /* delay_variation */) {
+ErrorCode LinkLayerController::QosSetup(uint16_t handle, uint8_t service_type,
+                                        uint32_t /* token_rate */,
+                                        uint32_t /* peak_bandwidth */,
+                                        uint32_t /* latency */,
+                                        uint32_t /* delay_variation */) {
   if (!connections_.HasHandle(handle)) {
-    return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+    return ErrorCode::UNKNOWN_CONNECTION;
   }
 
   if (service_type > 0x02) {
-    return bluetooth::hci::ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
+    return ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
   }
 
   // TODO: implement real logic
-  return bluetooth::hci::ErrorCode::COMMAND_DISALLOWED;
+  return ErrorCode::COMMAND_DISALLOWED;
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::SwitchRole(Address /* bd_addr */,
-                                                          uint8_t /* role */) {
+ErrorCode LinkLayerController::SwitchRole(Address /* bd_addr */,
+                                          uint8_t /* role */) {
   // TODO: implement real logic
-  return bluetooth::hci::ErrorCode::COMMAND_DISALLOWED;
+  return ErrorCode::COMMAND_DISALLOWED;
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::WriteLinkPolicySettings(
-    uint16_t handle, uint16_t) {
+ErrorCode LinkLayerController::WriteLinkPolicySettings(uint16_t handle,
+                                                       uint16_t) {
   if (!connections_.HasHandle(handle)) {
-    return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+    return ErrorCode::UNKNOWN_CONNECTION;
   }
-  return bluetooth::hci::ErrorCode::SUCCESS;
+  return ErrorCode::SUCCESS;
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::FlowSpecification(
+ErrorCode LinkLayerController::FlowSpecification(
     uint16_t handle, uint8_t flow_direction, uint8_t service_type,
     uint32_t /* token_rate */, uint32_t /* token_bucket_size */,
     uint32_t /* peak_bandwidth */, uint32_t /* access_latency */) {
   if (!connections_.HasHandle(handle)) {
-    return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+    return ErrorCode::UNKNOWN_CONNECTION;
   }
 
   if (flow_direction > 0x01 || service_type > 0x02) {
-    return bluetooth::hci::ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
+    return ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
   }
 
   // TODO: implement real logic
-  return bluetooth::hci::ErrorCode::COMMAND_DISALLOWED;
+  return ErrorCode::COMMAND_DISALLOWED;
 }
 
-bluetooth::hci::ErrorCode LinkLayerController::WriteLinkSupervisionTimeout(
-    uint16_t handle, uint16_t) {
+ErrorCode LinkLayerController::WriteLinkSupervisionTimeout(uint16_t handle,
+                                                           uint16_t) {
   if (!connections_.HasHandle(handle)) {
-    return bluetooth::hci::ErrorCode::UNKNOWN_CONNECTION;
+    return ErrorCode::UNKNOWN_CONNECTION;
   }
-  return bluetooth::hci::ErrorCode::SUCCESS;
+  return ErrorCode::SUCCESS;
 }
 
 void LinkLayerController::LeWhiteListClear() {
@@ -1630,8 +1625,8 @@
 void LinkLayerController::InquiryTimeout() {
   if (inquiry_state_ == Inquiry::InquiryState::INQUIRY) {
     inquiry_state_ = Inquiry::InquiryState::STANDBY;
-    auto packet = bluetooth::hci::InquiryCompleteBuilder::Create(
-        bluetooth::hci::ErrorCode::SUCCESS);
+    auto packet =
+        bluetooth::hci::InquiryCompleteBuilder::Create(ErrorCode::SUCCESS);
     send_event_(std::move(packet));
   }
 }
diff --git a/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.h b/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.h
index cffc935..b287123 100644
--- a/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.h
+++ b/vendor_libs/test_vendor_lib/model/controller/link_layer_controller.h
@@ -25,70 +25,62 @@
 #include "model/devices/device_properties.h"
 #include "model/setup/async_manager.h"
 #include "packets/link_layer_packets.h"
-#include "packets/packet_view.h"
 #include "security_manager.h"
 
 namespace test_vendor_lib {
 
 using ::bluetooth::hci::Address;
+using ::bluetooth::hci::ErrorCode;
+using ::bluetooth::hci::OpCode;
 
 class LinkLayerController {
  public:
   static constexpr size_t kIrk_size = 16;
 
   LinkLayerController(const DeviceProperties& properties) : properties_(properties) {}
-  bluetooth::hci::ErrorCode SendCommandToRemoteByAddress(
-      bluetooth::hci::OpCode opcode, packets::PacketView<true> args,
+  ErrorCode SendCommandToRemoteByAddress(
+      OpCode opcode, bluetooth::packet::PacketView<true> args,
       const Address& remote);
-  bluetooth::hci::ErrorCode SendCommandToRemoteByHandle(
-      bluetooth::hci::OpCode opcode, packets::PacketView<true> args,
-      uint16_t handle);
-  hci::Status SendScoToRemote(bluetooth::hci::ScoPacketView sco_packet);
-  hci::Status SendAclToRemote(bluetooth::hci::AclPacketView acl_packet);
+  ErrorCode SendCommandToRemoteByHandle(
+      OpCode opcode, bluetooth::packet::PacketView<true> args, uint16_t handle);
+  ErrorCode SendScoToRemote(bluetooth::hci::ScoPacketView sco_packet);
+  ErrorCode SendAclToRemote(bluetooth::hci::AclPacketView acl_packet);
 
   void WriteSimplePairingMode(bool enabled);
   void StartSimplePairing(const Address& address);
   void AuthenticateRemoteStage1(const Address& address, PairingType pairing_type);
   void AuthenticateRemoteStage2(const Address& address);
-  bluetooth::hci::ErrorCode LinkKeyRequestReply(
-      const Address& address, const std::array<uint8_t, 16>& key);
-  bluetooth::hci::ErrorCode LinkKeyRequestNegativeReply(const Address& address);
-  bluetooth::hci::ErrorCode IoCapabilityRequestReply(
-      const Address& peer, uint8_t io_capability, uint8_t oob_data_present_flag,
-      uint8_t authentication_requirements);
-  bluetooth::hci::ErrorCode IoCapabilityRequestNegativeReply(
-      const Address& peer, hci::Status reason);
-  bluetooth::hci::ErrorCode UserConfirmationRequestReply(const Address& peer);
-  bluetooth::hci::ErrorCode UserConfirmationRequestNegativeReply(
-      const Address& peer);
-  bluetooth::hci::ErrorCode UserPasskeyRequestReply(const Address& peer,
-                                                    uint32_t numeric_value);
-  bluetooth::hci::ErrorCode UserPasskeyRequestNegativeReply(
-      const Address& peer);
-  bluetooth::hci::ErrorCode RemoteOobDataRequestReply(
-      const Address& peer, const std::vector<uint8_t>& c,
-      const std::vector<uint8_t>& r);
-  bluetooth::hci::ErrorCode RemoteOobDataRequestNegativeReply(
-      const Address& peer);
+  ErrorCode LinkKeyRequestReply(const Address& address,
+                                const std::array<uint8_t, 16>& key);
+  ErrorCode LinkKeyRequestNegativeReply(const Address& address);
+  ErrorCode IoCapabilityRequestReply(const Address& peer, uint8_t io_capability,
+                                     uint8_t oob_data_present_flag,
+                                     uint8_t authentication_requirements);
+  ErrorCode IoCapabilityRequestNegativeReply(const Address& peer,
+                                             ErrorCode reason);
+  ErrorCode UserConfirmationRequestReply(const Address& peer);
+  ErrorCode UserConfirmationRequestNegativeReply(const Address& peer);
+  ErrorCode UserPasskeyRequestReply(const Address& peer,
+                                    uint32_t numeric_value);
+  ErrorCode UserPasskeyRequestNegativeReply(const Address& peer);
+  ErrorCode RemoteOobDataRequestReply(const Address& peer,
+                                      const std::vector<uint8_t>& c,
+                                      const std::vector<uint8_t>& r);
+  ErrorCode RemoteOobDataRequestNegativeReply(const Address& peer);
   void HandleSetConnectionEncryption(const Address& address, uint16_t handle, uint8_t encryption_enable);
-  bluetooth::hci::ErrorCode SetConnectionEncryption(uint16_t handle,
-                                                    uint8_t encryption_enable);
+  ErrorCode SetConnectionEncryption(uint16_t handle, uint8_t encryption_enable);
   void HandleAuthenticationRequest(const Address& address, uint16_t handle);
-  bluetooth::hci::ErrorCode AuthenticationRequested(uint16_t handle);
+  ErrorCode AuthenticationRequested(uint16_t handle);
 
-  bluetooth::hci::ErrorCode AcceptConnectionRequest(const Address& addr,
-                                                    bool try_role_switch);
+  ErrorCode AcceptConnectionRequest(const Address& addr, bool try_role_switch);
   void MakeSlaveConnection(const Address& addr, bool try_role_switch);
-  bluetooth::hci::ErrorCode RejectConnectionRequest(const Address& addr,
-                                                    uint8_t reason);
+  ErrorCode RejectConnectionRequest(const Address& addr, uint8_t reason);
   void RejectSlaveConnection(const Address& addr, uint8_t reason);
-  bluetooth::hci::ErrorCode CreateConnection(const Address& addr,
-                                             uint16_t packet_type,
-                                             uint8_t page_scan_mode,
-                                             uint16_t clock_offset,
-                                             uint8_t allow_role_switch);
-  bluetooth::hci::ErrorCode CreateConnectionCancel(const Address& addr);
-  bluetooth::hci::ErrorCode Disconnect(uint16_t handle, uint8_t reason);
+  ErrorCode CreateConnection(const Address& addr, uint16_t packet_type,
+                             uint8_t page_scan_mode, uint16_t clock_offset,
+                             uint8_t allow_role_switch);
+  ErrorCode CreateConnectionCancel(const Address& addr);
+  ErrorCode Disconnect(uint16_t handle, uint8_t reason);
 
  private:
   void DisconnectCleanup(uint16_t handle, uint8_t reason);
@@ -156,11 +148,10 @@
   bool LeResolvingListFull();
   void LeSetPrivacyMode(uint8_t address_type, Address addr, uint8_t mode);
 
-  bluetooth::hci::ErrorCode SetLeAdvertisingEnable(
-      uint8_t le_advertising_enable) {
+  ErrorCode SetLeAdvertisingEnable(uint8_t le_advertising_enable) {
     le_advertising_enable_ = le_advertising_enable;
     // TODO: Check properties and return errors
-    return bluetooth::hci::ErrorCode::SUCCESS;
+    return ErrorCode::SUCCESS;
   }
 
   void SetLeScanEnable(uint8_t le_scan_enable) {
@@ -184,9 +175,9 @@
   void SetLeAddressType(uint8_t le_address_type) {
     le_address_type_ = le_address_type;
   }
-  bluetooth::hci::ErrorCode SetLeConnect(bool le_connect) {
+  ErrorCode SetLeConnect(bool le_connect) {
     le_connect_ = le_connect;
-    return bluetooth::hci::ErrorCode::SUCCESS;
+    return ErrorCode::SUCCESS;
   }
   void SetLeConnectionIntervalMin(uint16_t min) {
     le_connection_interval_min_ = min;
@@ -228,32 +219,25 @@
   void SetInquiryScanEnable(bool enable);
   void SetPageScanEnable(bool enable);
 
-  bluetooth::hci::ErrorCode ChangeConnectionPacketType(uint16_t handle,
-                                                       uint16_t types);
-  bluetooth::hci::ErrorCode ChangeConnectionLinkKey(uint16_t handle);
-  bluetooth::hci::ErrorCode MasterLinkKey(uint8_t key_flag);
-  bluetooth::hci::ErrorCode HoldMode(uint16_t handle,
-                                     uint16_t hold_mode_max_interval,
-                                     uint16_t hold_mode_min_interval);
-  bluetooth::hci::ErrorCode SniffMode(uint16_t handle,
-                                      uint16_t sniff_max_interval,
-                                      uint16_t sniff_min_interval,
-                                      uint16_t sniff_attempt,
-                                      uint16_t sniff_timeout);
-  bluetooth::hci::ErrorCode ExitSniffMode(uint16_t handle);
-  bluetooth::hci::ErrorCode QosSetup(uint16_t handle, uint8_t service_type,
-                                     uint32_t token_rate,
-                                     uint32_t peak_bandwidth, uint32_t latency,
-                                     uint32_t delay_variation);
-  bluetooth::hci::ErrorCode SwitchRole(Address bd_addr, uint8_t role);
-  bluetooth::hci::ErrorCode WriteLinkPolicySettings(uint16_t handle,
-                                                    uint16_t settings);
-  bluetooth::hci::ErrorCode FlowSpecification(
-      uint16_t handle, uint8_t flow_direction, uint8_t service_type,
-      uint32_t token_rate, uint32_t token_bucket_size, uint32_t peak_bandwidth,
-      uint32_t access_latency);
-  bluetooth::hci::ErrorCode WriteLinkSupervisionTimeout(uint16_t handle,
-                                                        uint16_t timeout);
+  ErrorCode ChangeConnectionPacketType(uint16_t handle, uint16_t types);
+  ErrorCode ChangeConnectionLinkKey(uint16_t handle);
+  ErrorCode MasterLinkKey(uint8_t key_flag);
+  ErrorCode HoldMode(uint16_t handle, uint16_t hold_mode_max_interval,
+                     uint16_t hold_mode_min_interval);
+  ErrorCode SniffMode(uint16_t handle, uint16_t sniff_max_interval,
+                      uint16_t sniff_min_interval, uint16_t sniff_attempt,
+                      uint16_t sniff_timeout);
+  ErrorCode ExitSniffMode(uint16_t handle);
+  ErrorCode QosSetup(uint16_t handle, uint8_t service_type, uint32_t token_rate,
+                     uint32_t peak_bandwidth, uint32_t latency,
+                     uint32_t delay_variation);
+  ErrorCode SwitchRole(Address bd_addr, uint8_t role);
+  ErrorCode WriteLinkPolicySettings(uint16_t handle, uint16_t settings);
+  ErrorCode FlowSpecification(uint16_t handle, uint8_t flow_direction,
+                              uint8_t service_type, uint32_t token_rate,
+                              uint32_t token_bucket_size,
+                              uint32_t peak_bandwidth, uint32_t access_latency);
+  ErrorCode WriteLinkSupervisionTimeout(uint16_t handle, uint16_t timeout);
 
  protected:
   void SendLeLinkLayerPacket(
diff --git a/vendor_libs/test_vendor_lib/model/devices/device_properties.cc b/vendor_libs/test_vendor_lib/model/devices/device_properties.cc
index 2a4a970..8309268 100644
--- a/vendor_libs/test_vendor_lib/model/devices/device_properties.cc
+++ b/vendor_libs/test_vendor_lib/model/devices/device_properties.cc
@@ -22,7 +22,6 @@
 #include "base/json/json_reader.h"
 #include "base/values.h"
 
-#include "hci.h"
 #include "os/log.h"
 #include "osi/include/osi.h"
 
@@ -49,9 +48,9 @@
       sco_data_packet_size_(255),
       num_acl_data_packets_(10),
       num_sco_data_packets_(10),
-      version_(static_cast<uint8_t>(hci::Version::V4_1)),
+      version_(static_cast<uint8_t>(bluetooth::hci::HciVersion::V_4_1)),
       revision_(0),
-      lmp_pal_version_(static_cast<uint8_t>(hci::Version::V4_1)),
+      lmp_pal_version_(static_cast<uint8_t>(bluetooth::hci::LmpVersion::V_4_1)),
       manufacturer_name_(0),
       lmp_pal_subversion_(0),
       le_data_packet_length_(27),
diff --git a/vendor_libs/test_vendor_lib/model/devices/device_properties.h b/vendor_libs/test_vendor_lib/model/devices/device_properties.h
index 2cbd4b0..960e5d0 100644
--- a/vendor_libs/test_vendor_lib/model/devices/device_properties.h
+++ b/vendor_libs/test_vendor_lib/model/devices/device_properties.h
@@ -321,7 +321,7 @@
   Address address_;
   uint8_t page_scan_repetition_mode_;
   uint16_t clock_offset_;
-  uint8_t encryption_key_size_;
+  uint8_t encryption_key_size_{10};
 
   // Low Energy
   uint16_t le_data_packet_length_;
diff --git a/vendor_libs/test_vendor_lib/packets/Android.bp b/vendor_libs/test_vendor_lib/packets/Android.bp
deleted file mode 100644
index a769e14..0000000
--- a/vendor_libs/test_vendor_lib/packets/Android.bp
+++ /dev/null
@@ -1,74 +0,0 @@
-// packet library for libbt-rootcanal
-// ========================================================
-cc_library_static {
-    name: "libbt-rootcanal-packets",
-    defaults: [
-        "libchrome_support_defaults",
-        "clang_file_coverage",
-    ],
-    host_supported: true,
-    proprietary: true,
-    srcs: [
-        "iterator.cc",
-        "counted_builder.cc",
-        "packet_view.cc",
-        "raw_builder.cc",
-        "view.cc",
-        "hci/command_packet_builder.cc",
-        "hci/command_packet_view.cc",
-        "hci/hci_packet_builder.cc",
-    ],
-    cflags: [
-        "-fvisibility=hidden",
-    ],
-    local_include_dirs: [
-        ".",
-    ],
-    export_include_dirs: ["."],
-    include_dirs: [
-        "system/bt/vendor_libs/test_vendor_lib/include",
-        "system/bt/vendor_libs/test_vendor_lib/",
-        "system/bt/",
-        "system/bt/gd",
-    ],
-    shared_libs: [
-        "libbase",
-        "liblog",
-    ],
-}
-
-// Unit tests for the host
-// ========================================================
-cc_test_host {
-    name: "rootcanal-packets_test_host",
-    defaults: [
-        "libchrome_support_defaults",
-        "clang_file_coverage",
-        "clang_coverage_bin",
-    ],
-    srcs: [
-        "test/packet_builder_test.cc",
-        "test/packet_view_test.cc",
-        ":BluetoothHciClassSources",
-    ],
-    header_libs: [
-        "libbluetooth_headers",
-    ],
-    local_include_dirs: [
-        ".",
-    ],
-    include_dirs: [
-        "system/bt",
-        "system/bt/gd",
-        "system/bt/hci/include",
-        "system/bt/vendor_libs/test_vendor_lib",
-        "system/bt/vendor_libs/test_vendor_lib/include",
-    ],
-    shared_libs: [
-        "liblog",
-    ],
-    static_libs: [
-        "libbt-rootcanal-types",
-        "libbt-rootcanal-packets",
-    ],
-}
diff --git a/vendor_libs/test_vendor_lib/packets/base_packet_builder.h b/vendor_libs/test_vendor_lib/packets/base_packet_builder.h
deleted file mode 100644
index 92ae3a9..0000000
--- a/vendor_libs/test_vendor_lib/packets/base_packet_builder.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <cstdint>
-#include <forward_list>
-#include <iterator>
-#include <memory>
-#include <vector>
-
-namespace test_vendor_lib {
-namespace packets {
-
-// A little-endian PacketBuilder might contain a big-endian PacketBuilder,
-// so BasePacketBuilder provides a common base class.
-class BasePacketBuilder {
- public:
-  virtual ~BasePacketBuilder() = default;
-
-  virtual size_t size() const = 0;
-
-  // Write to the vector with the given iterator.
-  virtual void Serialize(std::back_insert_iterator<std::vector<uint8_t>> it) const = 0;
-
- protected:
-  BasePacketBuilder() = default;
-};
-
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/counted_builder.cc b/vendor_libs/test_vendor_lib/packets/counted_builder.cc
deleted file mode 100644
index 10d3ceb..0000000
--- a/vendor_libs/test_vendor_lib/packets/counted_builder.cc
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2018 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 "counted_builder.h"
-
-using std::vector;
-
-namespace test_vendor_lib {
-namespace packets {
-
-size_t CountedBuilder::size() const {
-  size_t payload_size = sizeof(uint8_t);
-  for (size_t i = 0; i < sub_builders_.size(); i++) {
-    payload_size += sub_builders_[i]->size();
-  }
-  return payload_size;
-}
-
-void CountedBuilder::Serialize(std::back_insert_iterator<std::vector<uint8_t>> it) const {
-  insert(static_cast<uint8_t>(sub_builders_.size()), it);
-  for (size_t i = 0; i < sub_builders_.size(); i++) {
-    sub_builders_[i]->Serialize(it);
-  }
-}
-
-void CountedBuilder::Add(std::unique_ptr<BasePacketBuilder> builder) {
-  sub_builders_.push_back(std::move(builder));
-}
-
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/counted_builder.h b/vendor_libs/test_vendor_lib/packets/counted_builder.h
deleted file mode 100644
index fed88c5..0000000
--- a/vendor_libs/test_vendor_lib/packets/counted_builder.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <cstdint>
-#include <forward_list>
-#include <memory>
-#include <vector>
-
-#include "packets/base_packet_builder.h"
-#include "packets/packet_builder.h"
-#include "packets/raw_builder.h"
-
-namespace test_vendor_lib {
-namespace packets {
-
-class CountedBuilder : public RawBuilder {
- public:
-  CountedBuilder() = default;
-  virtual ~CountedBuilder() = default;
-
-  virtual size_t size() const override;
-
-  virtual void Serialize(std::back_insert_iterator<std::vector<uint8_t>> it) const override;
-
-  void Add(std::unique_ptr<BasePacketBuilder> builder);
-
- private:
-  std::vector<std::unique_ptr<BasePacketBuilder>> sub_builders_;
-};
-
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/hci/command_packet_builder.cc b/vendor_libs/test_vendor_lib/packets/hci/command_packet_builder.cc
deleted file mode 100644
index b422bb8..0000000
--- a/vendor_libs/test_vendor_lib/packets/hci/command_packet_builder.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2018 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 "packets/hci/command_packet_builder.h"
-
-#include "os/log.h"
-
-using std::vector;
-using test_vendor_lib::hci::OpCode;
-
-namespace test_vendor_lib {
-namespace packets {
-
-CommandPacketBuilder::CommandPacketBuilder(OpCode opcode, std::unique_ptr<BasePacketBuilder> payload)
-    : opcode_(opcode), payload_(std::move(payload)) {}
-
-size_t CommandPacketBuilder::size() const {
-  return sizeof(uint16_t) + sizeof(uint8_t) + payload_->size();
-}
-
-void CommandPacketBuilder::Serialize(std::back_insert_iterator<std::vector<uint8_t>> it) const {
-  insert(static_cast<uint16_t>(opcode_), it);
-  uint8_t payload_size = static_cast<uint8_t>(payload_->size());
-
-  ASSERT_LOG(static_cast<size_t>(payload_size) == payload_->size(), "Payload too large for a command packet: %d",
-             static_cast<int>(payload_->size()));
-  insert(payload_size, it);
-  payload_->Serialize(it);
-}
-
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/hci/command_packet_builder.h b/vendor_libs/test_vendor_lib/packets/hci/command_packet_builder.h
deleted file mode 100644
index d59cf79..0000000
--- a/vendor_libs/test_vendor_lib/packets/hci/command_packet_builder.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <cstdint>
-#include <memory>
-#include <vector>
-
-#include "include/hci.h"
-#include "packets/hci/hci_packet_builder.h"
-#include "packets/packet_builder.h"
-
-namespace test_vendor_lib {
-namespace packets {
-
-// ACL data packets are specified in the Bluetooth Core Specification Version
-// 4.2, Volume 2, Part E, Section 5.4.2
-class CommandPacketBuilder : public HciPacketBuilder {
- public:
-  virtual ~CommandPacketBuilder() override = default;
-
-  static std::unique_ptr<CommandPacketBuilder> Create(hci::OpCode opcode, std::unique_ptr<BasePacketBuilder> payload);
-
-  virtual size_t size() const override;
-
-  virtual void Serialize(std::back_insert_iterator<std::vector<uint8_t>> it) const;
-
- private:
-  CommandPacketBuilder(hci::OpCode opcode, std::unique_ptr<BasePacketBuilder> payload);
-  CommandPacketBuilder() = delete;
-  hci::OpCode opcode_;
-  std::unique_ptr<BasePacketBuilder> payload_;
-};
-
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/hci/command_packet_view.cc b/vendor_libs/test_vendor_lib/packets/hci/command_packet_view.cc
deleted file mode 100644
index b0d27e6..0000000
--- a/vendor_libs/test_vendor_lib/packets/hci/command_packet_view.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2018 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 "packets/hci/command_packet_view.h"
-
-#include "os/log.h"
-
-using std::vector;
-
-namespace test_vendor_lib {
-namespace packets {
-
-CommandPacketView::CommandPacketView(std::shared_ptr<std::vector<uint8_t>> packet) : PacketView<true>(packet) {}
-
-CommandPacketView CommandPacketView::Create(std::shared_ptr<std::vector<uint8_t>> packet) {
-  return CommandPacketView(packet);
-}
-
-uint16_t CommandPacketView::GetOpcode() const {
-  return begin().extract<uint16_t>();
-}
-
-PacketView<true> CommandPacketView::GetPayload() const {
-  uint8_t payload_size = (begin() + sizeof(uint16_t)).extract<uint8_t>();
-  ASSERT_LOG(static_cast<uint8_t>(size() - sizeof(uint16_t) - sizeof(uint8_t)) == payload_size,
-             "Malformed Command packet payload_size %d + 2 != %d", static_cast<int>(payload_size),
-             static_cast<int>(size()));
-  return SubViewLittleEndian(sizeof(uint16_t) + sizeof(uint8_t), size());
-}
-
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/hci/command_packet_view.h b/vendor_libs/test_vendor_lib/packets/hci/command_packet_view.h
deleted file mode 100644
index 6355c1e..0000000
--- a/vendor_libs/test_vendor_lib/packets/hci/command_packet_view.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <cstdint>
-#include <memory>
-#include <vector>
-
-#include "packets/packet_view.h"
-
-namespace test_vendor_lib {
-namespace packets {
-
-// Command packets are specified in the Bluetooth Core Specification Version
-// 4.2, Volume 2, Part E, Section 5.4.1
-class CommandPacketView : public PacketView<true> {
- public:
-  virtual ~CommandPacketView() override = default;
-
-  static CommandPacketView Create(std::shared_ptr<std::vector<uint8_t>> packet);
-
-  uint16_t GetOpcode() const;
-
-  PacketView<true> GetPayload() const;
-
- private:
-  CommandPacketView(std::shared_ptr<std::vector<uint8_t>> packet);
-  CommandPacketView() = delete;
-};
-
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/hci/hci_packet_builder.cc b/vendor_libs/test_vendor_lib/packets/hci/hci_packet_builder.cc
deleted file mode 100644
index 1d5689b..0000000
--- a/vendor_libs/test_vendor_lib/packets/hci/hci_packet_builder.cc
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2018 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 "packets/hci/hci_packet_builder.h"
-
-using std::vector;
-
-namespace test_vendor_lib {
-namespace packets {
-
-std::shared_ptr<std::vector<uint8_t>> HciPacketBuilder::ToVector() {
-  std::shared_ptr<std::vector<uint8_t>> to_return = std::make_shared<std::vector<uint8_t>>();
-  std::back_insert_iterator<std::vector<uint8_t>> it(*to_return);
-  Serialize(it);
-  return to_return;
-}
-
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/hci/hci_packet_builder.h b/vendor_libs/test_vendor_lib/packets/hci/hci_packet_builder.h
deleted file mode 100644
index d508696..0000000
--- a/vendor_libs/test_vendor_lib/packets/hci/hci_packet_builder.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <cstdint>
-
-#include "packets/packet_builder.h"
-
-namespace test_vendor_lib {
-namespace packets {
-
-// Base packet for HCI packets specified in the Bluetooth Core Specification
-// Version 4.2, Volume 2, Part E, Section 5.4
-class HciPacketBuilder : public PacketBuilder<true> {
- public:
-  virtual ~HciPacketBuilder() override = default;
-
-  std::shared_ptr<std::vector<uint8_t>> ToVector();
-
- protected:
-  HciPacketBuilder() = default;
-};
-
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/iterator.cc b/vendor_libs/test_vendor_lib/packets/iterator.cc
deleted file mode 100644
index dca3c82..0000000
--- a/vendor_libs/test_vendor_lib/packets/iterator.cc
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright 2018 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 "iterator.h"
-
-#include "os/log.h"
-
-namespace test_vendor_lib {
-namespace packets {
-
-template <bool little_endian>
-Iterator<little_endian>::Iterator(std::forward_list<View> data, size_t offset) {
-  data_ = data;
-  index_ = offset;
-  length_ = 0;
-  for (auto& view : data) {
-    length_ += view.size();
-  }
-}
-
-template <bool little_endian>
-Iterator<little_endian> Iterator<little_endian>::operator+(int offset) {
-  auto itr(*this);
-
-  return itr += offset;
-}
-
-template <bool little_endian>
-Iterator<little_endian>& Iterator<little_endian>::operator+=(int offset) {
-  index_ += offset;
-  return *this;
-}
-
-template <bool little_endian>
-Iterator<little_endian> Iterator<little_endian>::operator++(int) {
-  auto itr(*this);
-  index_++;
-  return itr;
-}
-
-template <bool little_endian>
-Iterator<little_endian>& Iterator<little_endian>::operator++() {
-  index_++;
-  return *this;
-}
-
-template <bool little_endian>
-Iterator<little_endian> Iterator<little_endian>::operator-(int offset) {
-  auto itr(*this);
-
-  return itr -= offset;
-}
-
-template <bool little_endian>
-int Iterator<little_endian>::operator-(Iterator<little_endian>& itr) {
-  return index_ - itr.index_;
-}
-
-template <bool little_endian>
-Iterator<little_endian>& Iterator<little_endian>::operator-=(int offset) {
-  index_ -= offset;
-
-  return *this;
-}
-
-template <bool little_endian>
-Iterator<little_endian> Iterator<little_endian>::operator--(int) {
-  auto itr(*this);
-  if (index_ != 0) index_--;
-
-  return itr;
-}
-
-template <bool little_endian>
-Iterator<little_endian>& Iterator<little_endian>::operator--() {
-  if (index_ != 0) index_--;
-
-  return *this;
-}
-
-template <bool little_endian>
-Iterator<little_endian>& Iterator<little_endian>::operator=(const Iterator<little_endian>& itr) {
-  data_ = itr.data_;
-  index_ = itr.index_;
-
-  return *this;
-}
-
-template <bool little_endian>
-bool Iterator<little_endian>::operator==(const Iterator<little_endian>& itr) const {
-  return index_ == itr.index_;
-}
-
-template <bool little_endian>
-bool Iterator<little_endian>::operator!=(const Iterator<little_endian>& itr) const {
-  return !(*this == itr);
-}
-
-template <bool little_endian>
-bool Iterator<little_endian>::operator<(const Iterator<little_endian>& itr) const {
-  return index_ < itr.index_;
-}
-
-template <bool little_endian>
-bool Iterator<little_endian>::operator>(const Iterator<little_endian>& itr) const {
-  return index_ > itr.index_;
-}
-
-template <bool little_endian>
-bool Iterator<little_endian>::operator<=(const Iterator<little_endian>& itr) const {
-  return index_ <= itr.index_;
-}
-
-template <bool little_endian>
-bool Iterator<little_endian>::operator>=(const Iterator<little_endian>& itr) const {
-  return index_ >= itr.index_;
-}
-
-template <bool little_endian>
-uint8_t Iterator<little_endian>::operator*() const {
-  ASSERT_LOG(index_ < length_, "Index %d out of bounds: %d", static_cast<int>(index_), static_cast<int>(length_));
-  size_t index = index_;
-
-  for (auto view : data_) {
-    if (index < view.size()) {
-      return view[index];
-    }
-    index -= view.size();
-  }
-  LOG_ALWAYS_FATAL("Out of fragments searching for Index %d", static_cast<int>(index_));
-  return 0;
-}
-
-template <bool little_endian>
-size_t Iterator<little_endian>::NumBytesRemaining() const {
-  if (length_ > index_) {
-    return length_ - index_;
-  } else {
-    return 0;
-  }
-}
-
-// Explicit instantiations for both types of Iterators.
-template class Iterator<true>;
-template class Iterator<false>;
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/iterator.h b/vendor_libs/test_vendor_lib/packets/iterator.h
deleted file mode 100644
index 2f01fb9..0000000
--- a/vendor_libs/test_vendor_lib/packets/iterator.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <cstdint>
-#include <forward_list>
-
-#include "hci/address.h"
-#include "view.h"
-
-namespace test_vendor_lib {
-namespace packets {
-
-using ::bluetooth::hci::Address;
-
-// Templated Iterator for endianness
-template <bool little_endian>
-class Iterator : public std::iterator<std::random_access_iterator_tag, uint8_t> {
- public:
-  Iterator(std::forward_list<View> data, size_t offset);
-  Iterator(const Iterator& itr) = default;
-  virtual ~Iterator() = default;
-
-  // All addition and subtraction operators are unbounded.
-  Iterator operator+(int offset);
-  Iterator& operator+=(int offset);
-  Iterator operator++(int);
-  Iterator& operator++();
-
-  Iterator operator-(int offset);
-  int operator-(Iterator& itr);
-  Iterator& operator-=(int offset);
-  Iterator operator--(int);
-  Iterator& operator--();
-
-  Iterator& operator=(const Iterator& itr);
-
-  bool operator!=(const Iterator& itr) const;
-  bool operator==(const Iterator& itr) const;
-
-  bool operator<(const Iterator& itr) const;
-  bool operator>(const Iterator& itr) const;
-
-  bool operator<=(const Iterator& itr) const;
-  bool operator>=(const Iterator& itr) const;
-
-  uint8_t operator*() const;
-  uint8_t operator->() const;
-
-  size_t NumBytesRemaining() const;
-
-  // Get the next sizeof(FixedWidthPODType) bytes and return the filled type
-  template <typename FixedWidthPODType>
-  FixedWidthPODType extract() {
-    static_assert(std::is_pod<FixedWidthPODType>::value, "Iterator::extract requires an fixed type.");
-    FixedWidthPODType extracted_value;
-    uint8_t* value_ptr = (uint8_t*)&extracted_value;
-
-    for (size_t i = 0; i < sizeof(FixedWidthPODType); i++) {
-      size_t index = (little_endian ? i : sizeof(FixedWidthPODType) - i - 1);
-      value_ptr[index] = *((*this)++);
-    }
-    return extracted_value;
-  }
-
- private:
-  std::forward_list<View> data_;
-  size_t index_;
-  size_t length_;
-};
-
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/packet_builder.h b/vendor_libs/test_vendor_lib/packets/packet_builder.h
deleted file mode 100644
index 44feac8..0000000
--- a/vendor_libs/test_vendor_lib/packets/packet_builder.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <cstdint>
-#include <forward_list>
-#include <iterator>
-#include <memory>
-#include <vector>
-
-#include "base_packet_builder.h"
-#include "hci/address.h"
-#include "types/class_of_device.h"
-
-namespace test_vendor_lib {
-namespace packets {
-
-using ::bluetooth::hci::Address;
-
-// Abstract base class that is subclassed to build specifc packets.
-// The template parameter little_endian controls the generation of insert().
-template <bool little_endian>
-class PacketBuilder : public BasePacketBuilder {
- public:
-  PacketBuilder() = default;
-  virtual ~PacketBuilder() = default;
-
-  // Classes which need fragmentation should define a function like this:
-  // std::forward_list<DerivedBuilder>& Fragment(size_t max_size);
-
- protected:
-  // Write sizeof(FixedWidthIntegerType) bytes using the iterator
-  template <typename FixedWidthIntegerType,
-            typename std::enable_if<std::is_integral<FixedWidthIntegerType>::value, int>::type = 0>
-  void insert(FixedWidthIntegerType value, std::back_insert_iterator<std::vector<uint8_t>> it) const {
-    for (size_t i = 0; i < sizeof(FixedWidthIntegerType); i++) {
-      if (little_endian == true) {
-        *it = static_cast<uint8_t>(value >> (i * 8));
-      } else {
-        *it = static_cast<uint8_t>(value >> ((sizeof(FixedWidthIntegerType) - i - 1) * 8));
-      }
-      it++;
-    }
-  }
-
-  // Specialized insert that allows inserting enums without casting
-  template <typename Enum, typename std::enable_if<std::is_enum_v<Enum>, int>::type = 0>
-  inline void insert(Enum value, std::back_insert_iterator<std::vector<uint8_t>> it) const {
-    using enum_type = typename std::underlying_type_t<Enum>;
-    static_assert(std::is_unsigned_v<enum_type>, "Enum type is signed. Did you forget to specify the enum size?");
-    insert<enum_type>(static_cast<enum_type>(value), it);
-  }
-
-  // Write a vector of FixedWidthIntegerType using the iterator
-  template <typename FixedWidthIntegerType>
-  void insert_vector(const std::vector<FixedWidthIntegerType>& vec,
-                     std::back_insert_iterator<std::vector<uint8_t>> it) const {
-    static_assert(std::is_integral<FixedWidthIntegerType>::value,
-                  "PacketBuilder::insert requires an integral type vector.");
-    for (const auto& element : vec) {
-      insert(element, it);
-    }
-  }
-
-  void insert_address(const Address& addr, std::back_insert_iterator<std::vector<uint8_t>> it) const {
-    for (const auto& element : addr.address) {
-      insert(element, it);
-    }
-  }
-
-  void insert_class_of_device(const ClassOfDevice& cod, std::back_insert_iterator<std::vector<uint8_t>> it) const {
-    for (const auto& element : cod.cod) {
-      insert(element, it);
-    }
-  }
-};
-
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/packet_view.cc b/vendor_libs/test_vendor_lib/packets/packet_view.cc
deleted file mode 100644
index 65cd4e7..0000000
--- a/vendor_libs/test_vendor_lib/packets/packet_view.cc
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2018 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 "packet_view.h"
-
-#include <algorithm>
-
-#include "os/log.h"
-
-namespace test_vendor_lib {
-namespace packets {
-
-template <bool little_endian>
-PacketView<little_endian>::PacketView(const std::forward_list<class View> fragments)
-    : fragments_(fragments), length_(0) {
-  for (auto fragment : fragments_) {
-    length_ += fragment.size();
-  }
-}
-
-template <bool little_endian>
-PacketView<little_endian>::PacketView(std::shared_ptr<std::vector<uint8_t>> packet)
-    : fragments_({View(packet, 0, packet->size())}), length_(packet->size()) {}
-
-template <bool little_endian>
-Iterator<little_endian> PacketView<little_endian>::begin() const {
-  return Iterator<little_endian>(this->fragments_, 0);
-}
-
-template <bool little_endian>
-Iterator<little_endian> PacketView<little_endian>::end() const {
-  return Iterator<little_endian>(this->fragments_, size());
-}
-
-template <bool little_endian>
-uint8_t PacketView<little_endian>::operator[](size_t index) const {
-  return at(index);
-}
-
-template <bool little_endian>
-uint8_t PacketView<little_endian>::at(size_t index) const {
-  ASSERT_LOG(index < length_, "Index %d out of bounds", static_cast<int>(index));
-  for (const auto& fragment : fragments_) {
-    if (index < fragment.size()) {
-      return fragment[index];
-    }
-    index -= fragment.size();
-  }
-  LOG_ALWAYS_FATAL("Out of fragments searching for Index %d", static_cast<int>(index));
-  return 0;
-}
-
-template <bool little_endian>
-size_t PacketView<little_endian>::size() const {
-  return length_;
-}
-
-template <bool little_endian>
-std::forward_list<View> PacketView<little_endian>::SubViewList(size_t begin, size_t end) const {
-  ASSERT_LOG(begin <= end, "Begin %d is past end %d", static_cast<int>(begin), static_cast<int>(end));
-  ASSERT_LOG(end <= length_, "End %d is too large", static_cast<int>(end));
-  std::forward_list<View> view_list;
-  std::forward_list<View>::iterator it = view_list.before_begin();
-  size_t length = end - begin;
-  for (const auto& fragment : fragments_) {
-    if (begin >= fragment.size()) {
-      begin -= fragment.size();
-    } else {
-      View view(fragment, begin, begin + std::min(length, fragment.size() - begin));
-      length -= view.size();
-      it = view_list.insert_after(it, view);
-      begin = 0;
-    }
-  }
-  return view_list;
-}
-
-template <bool little_endian>
-PacketView<true> PacketView<little_endian>::SubViewLittleEndian(size_t begin, size_t end) const {
-  return PacketView<true>(SubViewList(begin, end));
-}
-
-template <bool little_endian>
-PacketView<false> PacketView<little_endian>::SubViewBigEndian(size_t begin, size_t end) const {
-  return PacketView<false>(SubViewList(begin, end));
-}
-
-// Explicit instantiations for both types of PacketViews.
-template class PacketView<true>;
-template class PacketView<false>;
-
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/packet_view.h b/vendor_libs/test_vendor_lib/packets/packet_view.h
deleted file mode 100644
index 22c530a..0000000
--- a/vendor_libs/test_vendor_lib/packets/packet_view.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <cstdint>
-#include <forward_list>
-
-#include "iterator.h"
-#include "view.h"
-
-namespace test_vendor_lib {
-namespace packets {
-
-// Abstract base class that is subclassed to provide type-specifc accessors.
-// Holds a shared pointer to the underlying data.
-// The template parameter little_endian controls the generation of extract().
-template <bool little_endian>
-class PacketView {
- public:
-  PacketView(const std::forward_list<class View> fragments);
-  PacketView(std::shared_ptr<std::vector<uint8_t>> packet);
-  PacketView(const PacketView& PacketView) = default;
-  virtual ~PacketView() = default;
-
-  virtual Iterator<little_endian> begin() const;
-
-  virtual Iterator<little_endian> end() const;
-
-  uint8_t operator[](size_t i) const;
-
-  uint8_t at(size_t index) const;
-
-  size_t size() const;
-
-  PacketView<true> SubViewLittleEndian(size_t begin, size_t end) const;
-
-  PacketView<false> SubViewBigEndian(size_t begin, size_t end) const;
-
- private:
-  std::forward_list<View> fragments_;
-  size_t length_;
-  PacketView<little_endian>() = delete;
-  std::forward_list<View> SubViewList(size_t begin, size_t end) const;
-};
-
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/raw_builder.cc b/vendor_libs/test_vendor_lib/packets/raw_builder.cc
deleted file mode 100644
index 2ba2198..0000000
--- a/vendor_libs/test_vendor_lib/packets/raw_builder.cc
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2018 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 "raw_builder.h"
-
-#include <algorithm>
-
-using std::vector;
-
-namespace test_vendor_lib {
-namespace packets {
-
-RawBuilder::RawBuilder(size_t max_bytes) : max_bytes_(max_bytes) {}
-
-bool RawBuilder::AddOctets(size_t octets, const vector<uint8_t>& bytes) {
-  if (payload_.size() + octets > max_bytes_) return false;
-
-  if (octets != bytes.size()) return false;
-
-  payload_.insert(payload_.end(), bytes.begin(), bytes.end());
-
-  return true;
-}
-
-bool RawBuilder::AddOctets(const vector<uint8_t>& bytes) {
-  return AddOctets(bytes.size(), bytes);
-}
-
-bool RawBuilder::AddOctets(size_t octets, uint64_t value) {
-  vector<uint8_t> val_vector;
-
-  uint64_t v = value;
-
-  if (octets > sizeof(uint64_t)) return false;
-
-  for (size_t i = 0; i < octets; i++) {
-    val_vector.push_back(v & 0xff);
-    v = v >> 8;
-  }
-
-  if (v != 0) return false;
-
-  return AddOctets(octets, val_vector);
-}
-
-bool RawBuilder::AddAddress(const Address& address) {
-  if (payload_.size() + Address::kLength > max_bytes_) return false;
-
-  for (size_t i = 0; i < Address::kLength; i++) {
-    payload_.push_back(address.address[i]);
-  }
-  return true;
-}
-
-bool RawBuilder::AddOctets1(uint8_t value) {
-  return AddOctets(1, value);
-}
-
-bool RawBuilder::AddOctets2(uint16_t value) {
-  return AddOctets(2, value);
-}
-
-bool RawBuilder::AddOctets3(uint32_t value) {
-  return AddOctets(3, value);
-}
-
-bool RawBuilder::AddOctets4(uint32_t value) {
-  return AddOctets(4, value);
-}
-
-bool RawBuilder::AddOctets6(uint64_t value) {
-  return AddOctets(6, value);
-}
-
-bool RawBuilder::AddOctets8(uint64_t value) {
-  return AddOctets(8, value);
-}
-
-bool RawBuilder::CanAddOctets(size_t num_bytes) const {
-  return payload_.size() + num_bytes <= max_bytes_;
-}
-
-void RawBuilder::Serialize(std::back_insert_iterator<std::vector<uint8_t>> it) const {
-  for (const auto& val : payload_) {
-    insert(val, it);
-  }
-}
-
-size_t RawBuilder::size() const {
-  return payload_.size();
-}
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/raw_builder.h b/vendor_libs/test_vendor_lib/packets/raw_builder.h
deleted file mode 100644
index 82ba885..0000000
--- a/vendor_libs/test_vendor_lib/packets/raw_builder.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <cstdint>
-#include <vector>
-
-#include "hci/address.h"
-#include "packets/packet_builder.h"
-
-namespace test_vendor_lib {
-namespace packets {
-
-using ::bluetooth::hci::Address;
-
-class RawBuilder : public PacketBuilder<true> {
- public:
-  RawBuilder() = default;
-  RawBuilder(size_t max_bytes);
-  virtual ~RawBuilder() = default;
-
-  virtual size_t size() const override;
-
-  virtual void Serialize(std::back_insert_iterator<std::vector<uint8_t>> it) const;
-
-  // Add |address| to the payload.  Return true if:
-  // - the new size of the payload is still <= |max_bytes_|
-  bool AddAddress(const Address& address);
-
-  // Return true if |num_bytes| can be added to the payload.
-  bool CanAddOctets(size_t num_bytes) const;
-
-  // Add |octets| bytes to the payload.  Return true if:
-  // - the size of |bytes| is equal to |octets| and
-  // - the new size of the payload is still <= |max_bytes_|
-  bool AddOctets(size_t octets, const std::vector<uint8_t>& bytes);
-
-  bool AddOctets(const std::vector<uint8_t>& bytes);
-
-  bool AddOctets1(uint8_t value);
-  bool AddOctets2(uint16_t value);
-  bool AddOctets3(uint32_t value);
-  bool AddOctets4(uint32_t value);
-  bool AddOctets6(uint64_t value);
-  bool AddOctets8(uint64_t value);
-
- private:
-  // Add |octets| bytes to the payload.  Return true if:
-  // - the value of |value| fits in |octets| bytes and
-  // - the new size of the payload is still <= |max_bytes_|
-  bool AddOctets(size_t octets, uint64_t value);
-
-  size_t max_bytes_{255};
-
-  // Underlying containers for storing the actual packet
-  std::vector<uint8_t> payload_;
-};
-
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/test/counted_builder_test.cc b/vendor_libs/test_vendor_lib/packets/test/counted_builder_test.cc
deleted file mode 100644
index c91466b..0000000
--- a/vendor_libs/test_vendor_lib/packets/test/counted_builder_test.cc
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2018 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 "packets/counted_builder.h"
-
-#include <gtest/gtest.h>
-#include <forward_list>
-#include <memory>
-
-#include "hci/address.h"
-
-using ::bluetooth::hci::Address;
-using std::vector;
-
-namespace {
-vector<uint8_t> count = {
-    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
-    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
-};
-
-}  // namespace
-
-namespace test_vendor_lib {
-namespace packets {
-
-class CountedBuilderTest : public ::testing::Test {
- public:
-  CountedBuilderTest() = default;
-  ~CountedBuilderTest() override = default;
-};
-
-TEST(CountedBuilderTest, buildCountTest) {
-  std::unique_ptr<CountedBuilder> count_builder = std::make_unique<CountedBuilder>();
-  ASSERT_EQ(1u, count_builder->size());
-  std::unique_ptr<RawBuilder> raw1 = std::make_unique<RawBuilder>();
-  std::unique_ptr<RawBuilder> raw2 = std::make_unique<RawBuilder>();
-  std::unique_ptr<RawBuilder> raw3 = std::make_unique<RawBuilder>();
-  std::unique_ptr<RawBuilder> raw4 = std::make_unique<RawBuilder>();
-  std::unique_ptr<RawBuilder> raw5 = std::make_unique<RawBuilder>();
-  std::unique_ptr<RawBuilder> raw6 = std::make_unique<RawBuilder>();
-  std::unique_ptr<RawBuilder> raw7 = std::make_unique<RawBuilder>();
-  raw1->AddOctets8(0x0706050403020100);
-  raw2->AddOctets4(0x0b0a0908);
-  raw3->AddOctets2(0x0d0c);
-  raw4->AddOctets1(0x0e);
-  raw5->AddOctets1(0x0f);
-  raw6->AddAddress(Address({0x10, 0x11, 0x12, 0x13, 0x14, 0x15}));
-  std::vector<uint8_t> count_subset(count.begin() + 0x16, count.end());
-  raw7->AddOctets(count_subset);
-
-  count_builder->Add(std::move(raw1));
-  count_builder->Add(std::move(raw2));
-  count_builder->Add(std::move(raw3));
-  count_builder->Add(std::move(raw4));
-  count_builder->Add(std::move(raw5));
-  count_builder->Add(std::move(raw6));
-  count_builder->Add(std::move(raw7));
-
-  ASSERT_EQ(count.size(), count_builder->size() - 1);
-
-  std::vector<uint8_t> packet;
-  std::back_insert_iterator<std::vector<uint8_t>> it(packet);
-
-  count_builder->Serialize(it);
-  ASSERT_EQ(7u, packet[0]);
-  std::vector<uint8_t> payload_packet(packet.begin() + 1, packet.end());
-
-  ASSERT_EQ(count, payload_packet);
-}
-
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/test/packet_builder_test.cc b/vendor_libs/test_vendor_lib/packets/test/packet_builder_test.cc
deleted file mode 100644
index a2b3569..0000000
--- a/vendor_libs/test_vendor_lib/packets/test/packet_builder_test.cc
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Copyright 2018 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 "packets/packet_builder.h"
-
-#include <gtest/gtest.h>
-#include <forward_list>
-#include <memory>
-
-using std::vector;
-
-namespace {
-vector<uint8_t> count_all = {
-    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
-    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
-};
-
-vector<uint8_t> count_1 = {
-    0x00,
-    0x01,
-    0x02,
-};
-
-vector<uint8_t> count_2 = {
-    0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
-};
-
-vector<uint8_t> count_3 = {
-    0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
-};
-}  // namespace
-
-namespace test_vendor_lib {
-namespace packets {
-
-template <bool little_endian>
-class EndianBuilder : public PacketBuilder<little_endian> {
- public:
-  EndianBuilder(uint8_t byte, uint16_t two_bytes, uint32_t four_bytes, uint64_t eight_bytes)
-      : byte_(byte), two_bytes_(two_bytes), four_bytes_(four_bytes), eight_bytes_(eight_bytes) {}
-  ~EndianBuilder() override = default;
-
-  size_t size() const override {
-    return sizeof(signature_) + sizeof(byte_) + sizeof(two_bytes_) + sizeof(four_bytes_) + sizeof(eight_bytes_);
-  }
-
-  virtual const std::unique_ptr<std::vector<uint8_t>> FinalPacket() {
-    std::unique_ptr<std::vector<uint8_t>> packet = std::make_unique<std::vector<uint8_t>>();
-    packet->reserve(size());
-    std::back_insert_iterator<std::vector<uint8_t>> it(*packet);
-    Serialize(it);
-    return packet;
-  }
-
-  void Serialize(std::back_insert_iterator<std::vector<uint8_t>> it) const override {
-    PacketBuilder<little_endian>::insert(signature_, it);
-    PacketBuilder<little_endian>::insert(byte_, it);
-    PacketBuilder<little_endian>::insert(two_bytes_, it);
-    PacketBuilder<little_endian>::insert(four_bytes_, it);
-    PacketBuilder<little_endian>::insert(eight_bytes_, it);
-  }
-
- private:
-  uint32_t signature_{(little_endian ? 0x03020100 : 0x00010203)};
-  uint8_t byte_;
-  uint16_t two_bytes_;
-  uint32_t four_bytes_;
-  uint64_t eight_bytes_;
-};
-
-class PacketBuilderEndianTest : public ::testing::Test {
- public:
-  PacketBuilderEndianTest() = default;
-  ~PacketBuilderEndianTest() override = default;
-};
-
-TEST(PacketBuilderEndianTest, insertTest) {
-  EndianBuilder<true> little(0x04, 0x0605, 0x0a090807, 0x1211100f0e0d0c0b);
-  EndianBuilder<false> big(0x04, 0x0506, 0x0708090a, 0x0b0c0d0e0f101112);
-  ASSERT_EQ(*big.FinalPacket(), *little.FinalPacket());
-}
-
-template <typename T>
-class VectorBuilder : public PacketBuilder<true> {
- public:
-  VectorBuilder(std::vector<uint64_t> vect) {
-    for (uint64_t element : vect) {
-      vect.push_back(static_cast<T>(element));
-    }
-  }
-  ~VectorBuilder() override = default;
-
-  size_t size() const override {
-    return vect_.size() * sizeof(T);
-  }
-
-  virtual const std::unique_ptr<std::vector<uint8_t>> FinalPacket() {
-    std::unique_ptr<std::vector<uint8_t>> packet = std::make_unique<std::vector<uint8_t>>();
-    packet->reserve(size());
-    std::back_insert_iterator<std::vector<uint8_t>> it(*packet);
-    Serialize(it);
-    return packet;
-  }
-
-  void Serialize(std::back_insert_iterator<std::vector<uint8_t>> it) const override {
-    PacketBuilder<true>::insert_vector(vect_, it);
-  }
-
- private:
-  std::vector<T> vect_;
-};
-
-template <typename T>
-class InsertElementsBuilder : public PacketBuilder<true> {
- public:
-  InsertElementsBuilder(std::vector<uint64_t> vect) {
-    for (uint64_t element : vect) {
-      vect.push_back(static_cast<T>(element));
-    }
-  }
-  ~InsertElementsBuilder() override = default;
-
-  size_t size() const override {
-    return vect_.size() * sizeof(T);
-  }
-
-  virtual const std::unique_ptr<std::vector<uint8_t>> FinalPacket() {
-    std::unique_ptr<std::vector<uint8_t>> packet = std::make_unique<std::vector<uint8_t>>();
-    packet->reserve(size());
-    std::back_insert_iterator<std::vector<uint8_t>> it(*packet);
-    Serialize(it);
-    return packet;
-  }
-
-  void Serialize(std::back_insert_iterator<std::vector<uint8_t>> it) const override {
-    for (T elem : vect_) {
-      PacketBuilder<true>::insert(elem, it);
-    }
-  }
-
- private:
-  std::vector<T> vect_;
-};
-
-std::vector<uint64_t> vector_data{
-    0x7060504030201000, 0x7161514131211101, 0x7262524232221202, 0x7363534333231303, 0x7464544434241404,
-    0x7565554535251505, 0x7666564636261606, 0x7767574737271707, 0x7868584838281808,
-};
-
-template <typename T>
-class VectorBuilderTest : public ::testing::Test {
- public:
-  VectorBuilderTest() = default;
-  ~VectorBuilderTest() override = default;
-
-  void SetUp() override {
-    packet_1_ = std::shared_ptr<VectorBuilder<T>>(new VectorBuilder<T>(vector_data));
-    packet_2_ = std::shared_ptr<InsertElementsBuilder<T>>(new InsertElementsBuilder<T>(vector_data));
-  }
-
-  void TearDown() override {
-    packet_1_.reset();
-    packet_2_.reset();
-  }
-
-  std::shared_ptr<VectorBuilder<T>> packet_1_;
-  std::shared_ptr<InsertElementsBuilder<T>> packet_2_;
-};
-
-using VectorBaseTypes = ::testing::Types<uint8_t, uint16_t, uint32_t, uint64_t, int8_t, int16_t, int32_t, int64_t>;
-TYPED_TEST_CASE(VectorBuilderTest, VectorBaseTypes);
-
-TYPED_TEST(VectorBuilderTest, insertVectorTest) {
-  ASSERT_EQ(*(this->packet_1_->FinalPacket()), *(this->packet_2_->FinalPacket()));
-}
-
-class NestedBuilder : public PacketBuilder<true> {
- public:
-  ~NestedBuilder() override = default;
-
-  size_t size() const override {
-    size_t payload_size = (payload_ ? payload_->size() : 0);
-    return 1 + payload_size;
-  }
-
-  static std::unique_ptr<NestedBuilder> Create(uint8_t level) {
-    return std::unique_ptr<NestedBuilder>(new NestedBuilder(level));
-  }
-
-  static std::unique_ptr<NestedBuilder> CreateNested(std::unique_ptr<BasePacketBuilder> payload, uint8_t level) {
-    return std::unique_ptr<NestedBuilder>(new NestedBuilder(std::move(payload), level));
-  }
-
-  virtual const std::unique_ptr<std::vector<uint8_t>> FinalPacket() {
-    std::unique_ptr<std::vector<uint8_t>> packet = std::make_unique<std::vector<uint8_t>>();
-    packet->reserve(size());
-    std::back_insert_iterator<std::vector<uint8_t>> it(*packet);
-    Serialize(it);
-    return packet;
-  }
-
-  void Serialize(std::back_insert_iterator<std::vector<uint8_t>> it) const override {
-    PacketBuilder<true>::insert(level_, it);
-    if (payload_) {
-      payload_->Serialize(it);
-    }
-  }
-
- private:
-  std::unique_ptr<BasePacketBuilder> payload_;
-  uint8_t level_;
-
-  NestedBuilder(std::unique_ptr<BasePacketBuilder> inner, uint8_t level) : payload_(std::move(inner)), level_(level) {}
-  NestedBuilder(uint8_t level) : level_(level) {}
-};
-
-class BuilderBuilderTest : public ::testing::Test {};
-
-TEST(BuilderBuilderTest, nestingTest) {
-  std::unique_ptr<BasePacketBuilder> innermost = NestedBuilder::Create(0);
-  std::unique_ptr<BasePacketBuilder> number_1 = NestedBuilder::CreateNested(std::move(innermost), 1);
-  std::unique_ptr<BasePacketBuilder> number_2 = NestedBuilder::CreateNested(std::move(number_1), 2);
-  std::unique_ptr<BasePacketBuilder> number_3 = NestedBuilder::CreateNested(std::move(number_2), 3);
-  std::unique_ptr<BasePacketBuilder> number_4 = NestedBuilder::CreateNested(std::move(number_3), 4);
-  std::unique_ptr<NestedBuilder> number_5 = NestedBuilder::CreateNested(std::move(number_4), 5);
-
-  std::vector<uint8_t> count_down{5, 4, 3, 2, 1, 0};
-  ASSERT_EQ(*number_5->FinalPacket(), count_down);
-}
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/test/packet_view_test.cc b/vendor_libs/test_vendor_lib/packets/test/packet_view_test.cc
deleted file mode 100644
index 11891c6..0000000
--- a/vendor_libs/test_vendor_lib/packets/test/packet_view_test.cc
+++ /dev/null
@@ -1,508 +0,0 @@
-/*
- * Copyright 2018 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 "packets/packet_view.h"
-
-#include <gtest/gtest.h>
-#include <forward_list>
-#include <memory>
-
-#include "hci/address.h"
-
-using ::bluetooth::hci::Address;
-using std::vector;
-
-namespace {
-vector<uint8_t> count_all = {
-    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
-    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
-};
-
-vector<uint8_t> count_1 = {
-    0x00,
-    0x01,
-    0x02,
-};
-
-vector<uint8_t> count_2 = {
-    0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
-};
-
-vector<uint8_t> count_3 = {
-    0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
-};
-}  // namespace
-
-namespace test_vendor_lib {
-namespace packets {
-
-template <typename T>
-class IteratorTest : public ::testing::Test {
- public:
-  IteratorTest() = default;
-  ~IteratorTest() override = default;
-
-  void SetUp() override {
-    packet = std::shared_ptr<T>(new T({View(std::make_shared<const vector<uint8_t>>(count_all), 0, count_all.size())}));
-  }
-
-  void TearDown() override {
-    packet.reset();
-  }
-
-  std::shared_ptr<T> packet;
-};
-
-using PacketViewTypes = ::testing::Types<PacketView<true>, PacketView<false>>;
-TYPED_TEST_CASE(IteratorTest, PacketViewTypes);
-
-class IteratorExtractTest : public ::testing::Test {
- public:
-  IteratorExtractTest() = default;
-  ~IteratorExtractTest() override = default;
-};
-
-template <typename T>
-class PacketViewTest : public IteratorTest<T> {
- public:
-  PacketViewTest() = default;
-  ~PacketViewTest() override = default;
-};
-
-using PacketViewTypes = ::testing::Types<PacketView<true>, PacketView<false>>;
-TYPED_TEST_CASE(PacketViewTest, PacketViewTypes);
-
-class PacketViewMultiViewTest : public ::testing::Test {
- public:
-  PacketViewMultiViewTest() = default;
-  ~PacketViewMultiViewTest() override = default;
-};
-
-class ViewTest : public ::testing::Test {
- public:
-  ViewTest() = default;
-  ~ViewTest() override = default;
-};
-
-TEST(IteratorExtractTest, extractLeTest) {
-  PacketView<true> packet({View(std::make_shared<const vector<uint8_t>>(count_all), 0, count_all.size())});
-  auto general_case = packet.begin();
-
-  ASSERT_EQ(0x00, general_case.extract<uint8_t>());
-  ASSERT_EQ(0x0201, general_case.extract<uint16_t>());
-  ASSERT_EQ(0x06050403u, general_case.extract<uint32_t>());
-  ASSERT_EQ(0x0e0d0c0b0a090807u, general_case.extract<uint64_t>());
-  ASSERT_EQ(0x0f, general_case.extract<uint8_t>());
-  Address raw({0x10, 0x11, 0x12, 0x13, 0x14, 0x15});
-  ASSERT_EQ(raw, general_case.extract<Address>());
-  ASSERT_EQ(0x16, general_case.extract<uint8_t>());
-}
-
-TEST(IteratorExtractTest, extractBeTest) {
-  PacketView<false> packet({View(std::make_shared<const vector<uint8_t>>(count_all), 0, count_all.size())});
-  auto general_case = packet.begin();
-
-  ASSERT_EQ(0x00, general_case.extract<uint8_t>());
-  ASSERT_EQ(0x0102, general_case.extract<uint16_t>());
-  ASSERT_EQ(0x03040506u, general_case.extract<uint32_t>());
-  ASSERT_EQ(0x0708090a0b0c0d0eu, general_case.extract<uint64_t>());
-  ASSERT_EQ(0x0f, general_case.extract<uint8_t>());
-  Address raw({0x15, 0x14, 0x13, 0x12, 0x11, 0x10});
-  ASSERT_EQ(raw, general_case.extract<Address>());
-  ASSERT_EQ(0x16, general_case.extract<uint8_t>());
-}
-
-TYPED_TEST(IteratorTest, extractBoundsDeathTest) {
-  auto bounds_test = this->packet->end();
-
-  ASSERT_DEATH(bounds_test.template extract<uint8_t>(), "");
-  ASSERT_DEATH(bounds_test.template extract<uint16_t>(), "");
-  ASSERT_DEATH(bounds_test.template extract<uint32_t>(), "");
-  ASSERT_DEATH(bounds_test.template extract<uint64_t>(), "");
-}
-
-TYPED_TEST(IteratorTest, dereferenceDeathTest) {
-  auto dereference_test = this->packet->end();
-
-  ASSERT_DEATH(*dereference_test, "");
-  ASSERT_EQ(0x1f, *(dereference_test - 1));
-}
-
-TYPED_TEST(IteratorTest, plusEqTest) {
-  auto plus_eq = this->packet->begin();
-  for (size_t i = 0; i < count_all.size(); i += 2) {
-    ASSERT_EQ(count_all[i], *plus_eq) << "+= test: Dereferenced iterator does not equal expected at index " << i;
-    plus_eq += 2;
-  }
-}
-
-TYPED_TEST(IteratorTest, preIncrementTest) {
-  auto plus_plus = this->packet->begin();
-  for (size_t i = 0; i < count_all.size() - 1; i++) {
-    ASSERT_EQ(count_all[i + 1], *(++plus_plus)) << "Pre-increment test: Dereferenced iterator does not equal expected "
-                                                << "at index " << i;
-  }
-}
-
-TYPED_TEST(IteratorTest, postIncrementTest) {
-  auto plus_plus = this->packet->begin();
-  for (size_t i = 0; i < count_all.size(); i++) {
-    ASSERT_EQ(count_all[i], *(plus_plus++)) << "Post-increment test: Dereferenced iterator does not equal expected "
-                                            << "at index " << i;
-  }
-}
-
-TYPED_TEST(IteratorTest, additionTest) {
-  auto plus = this->packet->begin();
-  for (size_t i = 0; i < count_all.size(); i++) {
-    ASSERT_EQ(count_all[i], *plus) << "+ test: Dereferenced iterator does not equal expected at index " << i;
-    plus = plus + 1;
-  }
-}
-
-TYPED_TEST(IteratorTest, minusEqTest) {
-  auto minus_eq = this->packet->end();
-  minus_eq -= 1;
-  size_t index = count_all.size() - 1;
-  for (size_t i = 0; index > i; i++) {
-    ASSERT_EQ(count_all[index], *minus_eq)
-        << "-= test: Dereferenced iterator does not equal expected at index " << index;
-    index -= i;
-    minus_eq -= i;
-  }
-}
-
-TYPED_TEST(IteratorTest, preDecrementTest) {
-  auto minus_minus = this->packet->end();
-  for (size_t i = count_all.size(); i > 0; i--) {
-    ASSERT_EQ(count_all[i - 1], *(--minus_minus))
-        << "Pre-decrement test: Dereferenced iterator does not equal expected "
-        << "at index " << i;
-  }
-}
-
-TYPED_TEST(IteratorTest, postDecrementTest) {
-  auto minus_minus = this->packet->end();
-  minus_minus--;
-  for (size_t i = count_all.size() - 1; i > 0; i--) {
-    ASSERT_EQ(count_all[i], *(minus_minus--)) << "Post-decrement test: Dereferenced iterator does not equal expected "
-                                              << "at index " << i;
-  }
-}
-
-TYPED_TEST(IteratorTest, subtractionTest) {
-  auto minus = this->packet->end();
-  minus = minus - 1;
-  for (size_t i = count_all.size() - 1; i > 0; i--) {
-    ASSERT_EQ(count_all[i], *minus) << "- test: Dereferenced iterator does not equal expected at index " << i;
-    minus = minus - 1;
-  }
-}
-
-TYPED_TEST(IteratorTest, differenceTest) {
-  auto begin = this->packet->begin();
-  auto end = this->packet->end();
-  int difference = end - begin;
-  ASSERT_EQ(difference, static_cast<int>(count_all.size()));
-  int neg_difference = begin - end;
-  ASSERT_EQ(neg_difference, -static_cast<int>(count_all.size()));
-}
-
-TYPED_TEST(IteratorTest, equalityTest) {
-  auto begin = this->packet->begin();
-  auto end = this->packet->end();
-  auto begin_copy = this->packet->begin();
-  auto end_copy = this->packet->end();
-  ASSERT_EQ(begin_copy, begin);
-  ASSERT_EQ(end_copy, end);
-}
-
-TYPED_TEST(IteratorTest, comparisonsTest) {
-  auto begin = this->packet->begin();
-  auto end = this->packet->end();
-  auto begin_copy = this->packet->begin();
-  auto end_copy = this->packet->end();
-  ASSERT_EQ(begin_copy, begin);
-  ASSERT_EQ(end_copy, end);
-  ASSERT_NE(begin, end);
-  ASSERT_TRUE(begin < end);
-  ASSERT_FALSE(end < end);
-  ASSERT_FALSE(end < begin);
-  ASSERT_FALSE(begin > end);
-  ASSERT_FALSE(end > end);
-  ASSERT_TRUE(end > begin);
-  ASSERT_TRUE(begin <= end);
-  ASSERT_TRUE(end <= end);
-  ASSERT_FALSE(end <= begin);
-  ASSERT_FALSE(begin >= end);
-  ASSERT_TRUE(end >= end);
-  ASSERT_TRUE(end >= begin);
-}
-
-TYPED_TEST(PacketViewTest, getLengthTest) {
-  size_t length = this->packet->size();
-  ASSERT_EQ(length, count_all.size());
-}
-
-TYPED_TEST(PacketViewTest, getAtIndexTest) {
-  size_t past_end = this->packet->size();
-  ASSERT_DEATH(this->packet->at(past_end), "");
-  size_t working_index = 0x1f;
-  ASSERT_EQ(0x1f, this->packet->at(working_index));
-}
-
-TYPED_TEST(PacketViewTest, arrayOperatorTest) {
-  size_t past_end = this->packet->size();
-  ASSERT_DEATH((*(this->packet))[past_end], "");
-  size_t working_index = 0x1f;
-  ASSERT_EQ(0x1f, (*(this->packet))[working_index]);
-}
-
-TYPED_TEST(PacketViewTest, numBytesRemainingTest) {
-  auto all = this->packet->begin();
-  size_t remaining = all.NumBytesRemaining();
-  for (size_t n = remaining; n > 0; n--) {
-    ASSERT_EQ(remaining, all.NumBytesRemaining());
-    all++;
-    remaining--;
-  }
-  ASSERT_EQ(static_cast<size_t>(0), all.NumBytesRemaining());
-  ASSERT_DEATH(*(all++), "");
-  all++;
-  ASSERT_EQ(static_cast<size_t>(0), all.NumBytesRemaining());
-  ASSERT_DEATH(*(all++), "");
-}
-
-using SubViewTestParam = std::pair<size_t, size_t>;
-class SubViewBaseTest : public ::testing::TestWithParam<SubViewTestParam> {
- public:
-  class SubPacketView : public PacketView<true> {
-   public:
-    using PacketView<true>::PacketView;
-    PacketView<true> Slice(size_t header, size_t tail) {
-      return PacketView<true>::SubViewLittleEndian(header, tail);
-    }
-  };
-};
-
-class SubViewPassTest : public SubViewBaseTest {};
-
-TEST_P(SubViewPassTest, subViewTest) {
-  auto header = GetParam().first;
-  auto tail = GetParam().second;
-  SubPacketView single_view({View(std::make_shared<const vector<uint8_t>>(count_all), 0, count_all.size())});
-  SubPacketView multi_view({
-      View(std::make_shared<const vector<uint8_t>>(count_1), 0, count_1.size()),
-      View(std::make_shared<const vector<uint8_t>>(count_2), 0, count_2.size()),
-      View(std::make_shared<const vector<uint8_t>>(count_3), 0, count_3.size()),
-  });
-
-  auto single_slice = single_view.Slice(header, tail);
-  auto multi_slice = multi_view.Slice(header, tail);
-
-  ASSERT_EQ(single_slice.size(), tail - header);
-  ASSERT_EQ(single_slice.size(), multi_slice.size());
-  for (size_t i = 0; i < single_slice.size(); i++) {
-    ASSERT_EQ(single_slice[i], multi_slice[i]);
-  }
-}
-
-static const size_t boundary_1 = count_1.size();
-static const size_t boundary_2 = count_1.size() + count_2.size();
-
-INSTANTIATE_TEST_CASE_P(
-    chopomatic, SubViewPassTest,
-    ::testing::Values(
-        // {begin, end} pairs for subsets into the PacketView
-        SubViewTestParam{0, 0}, SubViewTestParam{0, boundary_1}, SubViewTestParam{0, boundary_1 + 1},
-        SubViewTestParam{0, boundary_2}, SubViewTestParam{0, boundary_2 + 1}, SubViewTestParam{0, count_all.size()},
-        SubViewTestParam{boundary_1 - 1, boundary_1}, SubViewTestParam{boundary_1 - 1, boundary_1 + 1},
-        SubViewTestParam{boundary_1 - 1, boundary_2}, SubViewTestParam{boundary_1 - 1, boundary_2 + 1},
-        SubViewTestParam{boundary_1 - 1, count_all.size()}, SubViewTestParam{boundary_1, boundary_1},
-        SubViewTestParam{boundary_1, boundary_2}, SubViewTestParam{boundary_1, boundary_2 + 1},
-        SubViewTestParam{boundary_1, count_all.size()}, SubViewTestParam{boundary_2 - 1, boundary_2},
-        SubViewTestParam{boundary_2 - 1, boundary_2 + 1}, SubViewTestParam{boundary_2 - 1, count_all.size()},
-        SubViewTestParam{boundary_2, boundary_2}, SubViewTestParam{boundary_2, boundary_2 + 1},
-        SubViewTestParam{boundary_2, count_all.size()}, SubViewTestParam{count_all.size() - 1, count_all.size()},
-        SubViewTestParam{count_all.size(), count_all.size()}));
-
-class SubViewDeathTest : public SubViewBaseTest {};
-
-TEST_P(SubViewDeathTest, subViewDeathTest) {
-  auto header = GetParam().first;
-  auto tail = GetParam().second;
-  SubPacketView single_view({View(std::make_shared<const vector<uint8_t>>(count_all), 0, count_all.size())});
-  SubPacketView multi_view({
-      View(std::make_shared<const vector<uint8_t>>(count_1), 0, count_1.size()),
-      View(std::make_shared<const vector<uint8_t>>(count_2), 0, count_2.size()),
-      View(std::make_shared<const vector<uint8_t>>(count_3), 0, count_3.size()),
-  });
-
-  ASSERT_DEATH(auto single_slice = single_view.Slice(header, tail), "");
-  ASSERT_DEATH(auto multi_slice = multi_view.Slice(header, tail), "");
-}
-
-INSTANTIATE_TEST_CASE_P(chopomaticDeath, SubViewDeathTest,
-                        ::testing::Values(
-                            // {begin, end} pairs for subsets into the PacketView
-                            SubViewTestParam{1, 0}, SubViewTestParam{count_all.size(), count_all.size() - 1},
-                            SubViewTestParam{count_all.size(), count_all.size() + 1}));
-
-TEST(SubViewTest, simpleSubViewTest) {
-  PacketView<true> view({View(std::make_shared<const vector<uint8_t>>(count_all), 0, count_all.size())});
-  PacketView<true> sub_1_view = view.SubViewLittleEndian(0, view.size());
-  PacketView<true> sub_2_view = sub_1_view.SubViewLittleEndian(0, sub_1_view.size());
-  PacketView<true> sub_3_view = sub_2_view.SubViewLittleEndian(0, sub_2_view.size());
-  PacketView<true> sub_4_view = sub_3_view.SubViewLittleEndian(0, sub_3_view.size());
-  ASSERT_EQ(sub_1_view.size(), view.size());
-  ASSERT_EQ(sub_2_view.size(), view.size());
-  ASSERT_EQ(sub_3_view.size(), view.size());
-  ASSERT_EQ(sub_4_view.size(), view.size());
-}
-
-TEST(SubViewTest, realSubViewTest) {
-  PacketView<true> view({View(std::make_shared<const vector<uint8_t>>(count_all), 0, count_all.size())});
-  std::vector<PacketView<true>> sub_views{view};
-  for (size_t i = 1; i < 6; i++) {
-    size_t parent_size = sub_views[i - 1].size();
-    sub_views.push_back(sub_views[i - 1].SubViewLittleEndian(1, parent_size - 1));
-    ASSERT_EQ(sub_views[i][0], i);
-    ASSERT_EQ(sub_views[i].size(), parent_size - 2);
-  }
-}
-
-TEST(SubViewTest, subSubViewTest) {
-  PacketView<true> single_view({View(std::make_shared<const vector<uint8_t>>(count_all), 0, count_all.size())});
-  PacketView<true> multi_view({
-      View(std::make_shared<const vector<uint8_t>>(count_1), 0, count_1.size()),
-      View(std::make_shared<const vector<uint8_t>>(count_2), 0, count_2.size()),
-      View(std::make_shared<const vector<uint8_t>>(count_3), 0, count_3.size()),
-  });
-  ASSERT_EQ(single_view.size(), multi_view.size());
-  for (size_t i = 0; i < count_all.size() / 2; i++) {
-    PacketView<true> sub_single_view = single_view.SubViewLittleEndian(i, count_all.size() - i);
-    PacketView<true> sub_multi_view = multi_view.SubViewLittleEndian(i, count_all.size() - i);
-    ASSERT_EQ(count_all.size() - 2 * i, sub_single_view.size());
-    ASSERT_EQ(sub_single_view.size(), sub_multi_view.size());
-    for (size_t j = 0; j < sub_single_view.size() / 2; j++) {
-      PacketView<true> sub_sub_single_view = sub_single_view.SubViewLittleEndian(j, sub_single_view.size() - j);
-      PacketView<true> sub_sub_multi_view = sub_multi_view.SubViewLittleEndian(j, sub_multi_view.size() - j);
-      ASSERT_EQ(sub_single_view.size() - 2 * j, sub_sub_single_view.size());
-      ASSERT_EQ(sub_sub_single_view.size(), sub_sub_multi_view.size());
-    }
-  }
-}
-
-TEST(PacketViewMultiViewTest, sizeTest) {
-  PacketView<true> single_view({View(std::make_shared<const vector<uint8_t>>(count_all), 0, count_all.size())});
-  PacketView<true> multi_view({
-      View(std::make_shared<const vector<uint8_t>>(count_1), 0, count_1.size()),
-      View(std::make_shared<const vector<uint8_t>>(count_2), 0, count_2.size()),
-      View(std::make_shared<const vector<uint8_t>>(count_3), 0, count_3.size()),
-  });
-  ASSERT_EQ(single_view.size(), multi_view.size());
-}
-
-TEST(PacketViewMultiViewTest, dereferenceTestLittleEndian) {
-  PacketView<true> single_view({View(std::make_shared<const vector<uint8_t>>(count_all), 0, count_all.size())});
-  PacketView<true> multi_view({
-      View(std::make_shared<const vector<uint8_t>>(count_1), 0, count_1.size()),
-      View(std::make_shared<const vector<uint8_t>>(count_2), 0, count_2.size()),
-      View(std::make_shared<const vector<uint8_t>>(count_3), 0, count_3.size()),
-  });
-  auto single_itr = single_view.begin();
-  auto multi_itr = multi_view.begin();
-  for (size_t i = 0; i < single_view.size(); i++) {
-    ASSERT_EQ(*(single_itr++), *(multi_itr++));
-  }
-  ASSERT_DEATH(*multi_itr, "");
-}
-
-TEST(PacketViewMultiViewTest, dereferenceTestBigEndian) {
-  PacketView<false> single_view({View(std::make_shared<const vector<uint8_t>>(count_all), 0, count_all.size())});
-  PacketView<false> multi_view({
-      View(std::make_shared<const vector<uint8_t>>(count_1), 0, count_1.size()),
-      View(std::make_shared<const vector<uint8_t>>(count_2), 0, count_2.size()),
-      View(std::make_shared<const vector<uint8_t>>(count_3), 0, count_3.size()),
-  });
-  auto single_itr = single_view.begin();
-  auto multi_itr = multi_view.begin();
-  for (size_t i = 0; i < single_view.size(); i++) {
-    ASSERT_EQ(*(single_itr++), *(multi_itr++));
-  }
-  ASSERT_DEATH(*multi_itr, "");
-}
-
-TEST(PacketViewMultiViewTest, arrayOperatorTest) {
-  PacketView<true> single_view({View(std::make_shared<const vector<uint8_t>>(count_all), 0, count_all.size())});
-  PacketView<true> multi_view({
-      View(std::make_shared<const vector<uint8_t>>(count_1), 0, count_1.size()),
-      View(std::make_shared<const vector<uint8_t>>(count_2), 0, count_2.size()),
-      View(std::make_shared<const vector<uint8_t>>(count_3), 0, count_3.size()),
-  });
-  for (size_t i = 0; i < single_view.size(); i++) {
-    ASSERT_EQ(single_view[i], multi_view[i]);
-  }
-  ASSERT_DEATH(multi_view[single_view.size()], "");
-}
-
-TEST(ViewTest, arrayOperatorTest) {
-  View view_all(std::make_shared<const vector<uint8_t>>(count_all), 0, count_all.size());
-  size_t past_end = view_all.size();
-  for (size_t i = 0; i < past_end; i++) {
-    ASSERT_EQ(view_all[i], count_all[i]);
-  }
-  ASSERT_DEATH(view_all[past_end], "");
-
-  size_t header_size = 2;
-  size_t tail_size = 3;
-  View view_subset(std::make_shared<const vector<uint8_t>>(count_all), header_size, count_all.size() - tail_size);
-  View view_subset2(view_all, header_size, count_all.size() - tail_size);
-  size_t subset_length = view_subset.size();
-  for (size_t i = 0; i < subset_length; i++) {
-    ASSERT_EQ(view_subset[i], count_all[header_size + i]);
-    ASSERT_EQ(view_subset[i], view_subset2[i]);
-  }
-  ASSERT_DEATH(view_subset[subset_length + 1], "");
-  ASSERT_DEATH(view_subset2[subset_length + 1], "");
-}
-
-TEST(ViewTest, earlySubSubViewTest) {
-  View view(std::make_shared<const vector<uint8_t>>(count_all), 0, count_all.size());
-  View sub_1_view(view, view.size() - 3, view.size() - 1);
-  View sub_2_view(sub_1_view, 1, 2);
-  ASSERT_EQ(sub_1_view.size(), 2u);
-  ASSERT_EQ(sub_2_view.size(), 1u);
-}
-
-TEST(ViewTest, subSubViewTest) {
-  View view(std::make_shared<const vector<uint8_t>>(count_all), 0, count_all.size());
-  std::vector<View> sub_views{view};
-  for (size_t i = 1; i < 6; i++) {
-    size_t parent_size = sub_views[i - 1].size();
-    sub_views.push_back({View(sub_views[i - 1], 1, parent_size - 1)});
-    ASSERT_EQ(sub_views[i][0], i);
-    ASSERT_EQ(sub_views[i].size(), parent_size - 2);
-  }
-}
-
-TEST(ViewTest, zeroSubViewTest) {
-  View view(std::make_shared<const vector<uint8_t>>(count_all), 0, count_all.size());
-  View subview(view, view.size(), view.size() + 1);
-  ASSERT_EQ(subview.size(), 0u);
-}
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/test/raw_builder_test.cc b/vendor_libs/test_vendor_lib/packets/test/raw_builder_test.cc
deleted file mode 100644
index 8e69f9f..0000000
--- a/vendor_libs/test_vendor_lib/packets/test/raw_builder_test.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2018 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 "packets/raw_builder.h"
-
-#include <gtest/gtest.h>
-#include <forward_list>
-#include <memory>
-
-#include "hci/address.h"
-
-using ::bluetooth::hci::Address;
-using std::vector;
-
-namespace {
-vector<uint8_t> count = {
-    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
-    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
-};
-
-}  // namespace
-
-namespace test_vendor_lib {
-namespace packets {
-
-class RawBuilderTest : public ::testing::Test {
- public:
-  RawBuilderTest() = default;
-  ~RawBuilderTest() override = default;
-};
-
-TEST(RawBuilderTest, buildCountTest) {
-  std::unique_ptr<RawBuilder> count_builder = std::make_unique<RawBuilder>();
-  ASSERT_EQ(0u, count_builder->size());
-  count_builder->AddOctets8(0x0706050403020100);
-  count_builder->AddOctets4(0x0b0a0908);
-  count_builder->AddOctets2(0x0d0c);
-  count_builder->AddOctets1(0x0e);
-  count_builder->AddOctets1(0x0f);
-  count_builder->AddAddress(Address({0x10, 0x11, 0x12, 0x13, 0x14, 0x15}));
-  std::vector<uint8_t> count_subset(count.begin() + 0x16, count.end());
-  count_builder->AddOctets(count_subset);
-
-  ASSERT_EQ(count.size(), count_builder->size());
-
-  std::vector<uint8_t> packet;
-  std::back_insert_iterator<std::vector<uint8_t>> it(packet);
-
-  count_builder->Serialize(it);
-
-  ASSERT_EQ(count, packet);
-}
-
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/view.cc b/vendor_libs/test_vendor_lib/packets/view.cc
deleted file mode 100644
index a358169..0000000
--- a/vendor_libs/test_vendor_lib/packets/view.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2018 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 "view.h"
-
-#include "os/log.h"
-
-namespace test_vendor_lib {
-namespace packets {
-
-View::View(std::shared_ptr<const std::vector<uint8_t>> data, size_t begin, size_t end)
-    : data_(data), begin_(begin < data_->size() ? begin : data_->size()),
-      end_(end < data_->size() ? end : data_->size()) {}
-
-View::View(const View& view, size_t begin, size_t end) : data_(view.data_) {
-  begin_ = (begin < view.size() ? begin : view.size());
-  begin_ += view.begin_;
-  end_ = (end < view.size() ? end : view.size());
-  end_ += view.begin_;
-}
-
-uint8_t View::operator[](size_t i) const {
-  ASSERT_LOG(i + begin_ < end_, "Out of bounds access at %d", static_cast<int>(i));
-  return data_->operator[](i + begin_);
-}
-
-size_t View::size() const {
-  return end_ - begin_;
-}
-
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/packets/view.h b/vendor_libs/test_vendor_lib/packets/view.h
deleted file mode 100644
index ca38875..0000000
--- a/vendor_libs/test_vendor_lib/packets/view.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <cstdint>
-#include <vector>
-
-namespace test_vendor_lib {
-namespace packets {
-
-// Base class that holds a shared pointer to data with bounds.
-class View {
- public:
-  View(std::shared_ptr<const std::vector<uint8_t>> data, size_t begin, size_t end);
-  View(const View& view, size_t begin, size_t end);
-  View(const View& view) = default;
-  virtual ~View() = default;
-
-  uint8_t operator[](size_t i) const;
-
-  size_t size() const;
-
- private:
-  std::shared_ptr<const std::vector<uint8_t>> data_;
-  size_t begin_;
-  size_t end_;
-};
-
-}  // namespace packets
-}  // namespace test_vendor_lib
diff --git a/vendor_libs/test_vendor_lib/test/packet_builder_test.cc b/vendor_libs/test_vendor_lib/test/packet_builder_test.cc
deleted file mode 100644
index a2b3569..0000000
--- a/vendor_libs/test_vendor_lib/test/packet_builder_test.cc
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Copyright 2018 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 "packets/packet_builder.h"
-
-#include <gtest/gtest.h>
-#include <forward_list>
-#include <memory>
-
-using std::vector;
-
-namespace {
-vector<uint8_t> count_all = {
-    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
-    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
-};
-
-vector<uint8_t> count_1 = {
-    0x00,
-    0x01,
-    0x02,
-};
-
-vector<uint8_t> count_2 = {
-    0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
-};
-
-vector<uint8_t> count_3 = {
-    0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
-};
-}  // namespace
-
-namespace test_vendor_lib {
-namespace packets {
-
-template <bool little_endian>
-class EndianBuilder : public PacketBuilder<little_endian> {
- public:
-  EndianBuilder(uint8_t byte, uint16_t two_bytes, uint32_t four_bytes, uint64_t eight_bytes)
-      : byte_(byte), two_bytes_(two_bytes), four_bytes_(four_bytes), eight_bytes_(eight_bytes) {}
-  ~EndianBuilder() override = default;
-
-  size_t size() const override {
-    return sizeof(signature_) + sizeof(byte_) + sizeof(two_bytes_) + sizeof(four_bytes_) + sizeof(eight_bytes_);
-  }
-
-  virtual const std::unique_ptr<std::vector<uint8_t>> FinalPacket() {
-    std::unique_ptr<std::vector<uint8_t>> packet = std::make_unique<std::vector<uint8_t>>();
-    packet->reserve(size());
-    std::back_insert_iterator<std::vector<uint8_t>> it(*packet);
-    Serialize(it);
-    return packet;
-  }
-
-  void Serialize(std::back_insert_iterator<std::vector<uint8_t>> it) const override {
-    PacketBuilder<little_endian>::insert(signature_, it);
-    PacketBuilder<little_endian>::insert(byte_, it);
-    PacketBuilder<little_endian>::insert(two_bytes_, it);
-    PacketBuilder<little_endian>::insert(four_bytes_, it);
-    PacketBuilder<little_endian>::insert(eight_bytes_, it);
-  }
-
- private:
-  uint32_t signature_{(little_endian ? 0x03020100 : 0x00010203)};
-  uint8_t byte_;
-  uint16_t two_bytes_;
-  uint32_t four_bytes_;
-  uint64_t eight_bytes_;
-};
-
-class PacketBuilderEndianTest : public ::testing::Test {
- public:
-  PacketBuilderEndianTest() = default;
-  ~PacketBuilderEndianTest() override = default;
-};
-
-TEST(PacketBuilderEndianTest, insertTest) {
-  EndianBuilder<true> little(0x04, 0x0605, 0x0a090807, 0x1211100f0e0d0c0b);
-  EndianBuilder<false> big(0x04, 0x0506, 0x0708090a, 0x0b0c0d0e0f101112);
-  ASSERT_EQ(*big.FinalPacket(), *little.FinalPacket());
-}
-
-template <typename T>
-class VectorBuilder : public PacketBuilder<true> {
- public:
-  VectorBuilder(std::vector<uint64_t> vect) {
-    for (uint64_t element : vect) {
-      vect.push_back(static_cast<T>(element));
-    }
-  }
-  ~VectorBuilder() override = default;
-
-  size_t size() const override {
-    return vect_.size() * sizeof(T);
-  }
-
-  virtual const std::unique_ptr<std::vector<uint8_t>> FinalPacket() {
-    std::unique_ptr<std::vector<uint8_t>> packet = std::make_unique<std::vector<uint8_t>>();
-    packet->reserve(size());
-    std::back_insert_iterator<std::vector<uint8_t>> it(*packet);
-    Serialize(it);
-    return packet;
-  }
-
-  void Serialize(std::back_insert_iterator<std::vector<uint8_t>> it) const override {
-    PacketBuilder<true>::insert_vector(vect_, it);
-  }
-
- private:
-  std::vector<T> vect_;
-};
-
-template <typename T>
-class InsertElementsBuilder : public PacketBuilder<true> {
- public:
-  InsertElementsBuilder(std::vector<uint64_t> vect) {
-    for (uint64_t element : vect) {
-      vect.push_back(static_cast<T>(element));
-    }
-  }
-  ~InsertElementsBuilder() override = default;
-
-  size_t size() const override {
-    return vect_.size() * sizeof(T);
-  }
-
-  virtual const std::unique_ptr<std::vector<uint8_t>> FinalPacket() {
-    std::unique_ptr<std::vector<uint8_t>> packet = std::make_unique<std::vector<uint8_t>>();
-    packet->reserve(size());
-    std::back_insert_iterator<std::vector<uint8_t>> it(*packet);
-    Serialize(it);
-    return packet;
-  }
-
-  void Serialize(std::back_insert_iterator<std::vector<uint8_t>> it) const override {
-    for (T elem : vect_) {
-      PacketBuilder<true>::insert(elem, it);
-    }
-  }
-
- private:
-  std::vector<T> vect_;
-};
-
-std::vector<uint64_t> vector_data{
-    0x7060504030201000, 0x7161514131211101, 0x7262524232221202, 0x7363534333231303, 0x7464544434241404,
-    0x7565554535251505, 0x7666564636261606, 0x7767574737271707, 0x7868584838281808,
-};
-
-template <typename T>
-class VectorBuilderTest : public ::testing::Test {
- public:
-  VectorBuilderTest() = default;
-  ~VectorBuilderTest() override = default;
-
-  void SetUp() override {
-    packet_1_ = std::shared_ptr<VectorBuilder<T>>(new VectorBuilder<T>(vector_data));
-    packet_2_ = std::shared_ptr<InsertElementsBuilder<T>>(new InsertElementsBuilder<T>(vector_data));
-  }
-
-  void TearDown() override {
-    packet_1_.reset();
-    packet_2_.reset();
-  }
-
-  std::shared_ptr<VectorBuilder<T>> packet_1_;
-  std::shared_ptr<InsertElementsBuilder<T>> packet_2_;
-};
-
-using VectorBaseTypes = ::testing::Types<uint8_t, uint16_t, uint32_t, uint64_t, int8_t, int16_t, int32_t, int64_t>;
-TYPED_TEST_CASE(VectorBuilderTest, VectorBaseTypes);
-
-TYPED_TEST(VectorBuilderTest, insertVectorTest) {
-  ASSERT_EQ(*(this->packet_1_->FinalPacket()), *(this->packet_2_->FinalPacket()));
-}
-
-class NestedBuilder : public PacketBuilder<true> {
- public:
-  ~NestedBuilder() override = default;
-
-  size_t size() const override {
-    size_t payload_size = (payload_ ? payload_->size() : 0);
-    return 1 + payload_size;
-  }
-
-  static std::unique_ptr<NestedBuilder> Create(uint8_t level) {
-    return std::unique_ptr<NestedBuilder>(new NestedBuilder(level));
-  }
-
-  static std::unique_ptr<NestedBuilder> CreateNested(std::unique_ptr<BasePacketBuilder> payload, uint8_t level) {
-    return std::unique_ptr<NestedBuilder>(new NestedBuilder(std::move(payload), level));
-  }
-
-  virtual const std::unique_ptr<std::vector<uint8_t>> FinalPacket() {
-    std::unique_ptr<std::vector<uint8_t>> packet = std::make_unique<std::vector<uint8_t>>();
-    packet->reserve(size());
-    std::back_insert_iterator<std::vector<uint8_t>> it(*packet);
-    Serialize(it);
-    return packet;
-  }
-
-  void Serialize(std::back_insert_iterator<std::vector<uint8_t>> it) const override {
-    PacketBuilder<true>::insert(level_, it);
-    if (payload_) {
-      payload_->Serialize(it);
-    }
-  }
-
- private:
-  std::unique_ptr<BasePacketBuilder> payload_;
-  uint8_t level_;
-
-  NestedBuilder(std::unique_ptr<BasePacketBuilder> inner, uint8_t level) : payload_(std::move(inner)), level_(level) {}
-  NestedBuilder(uint8_t level) : level_(level) {}
-};
-
-class BuilderBuilderTest : public ::testing::Test {};
-
-TEST(BuilderBuilderTest, nestingTest) {
-  std::unique_ptr<BasePacketBuilder> innermost = NestedBuilder::Create(0);
-  std::unique_ptr<BasePacketBuilder> number_1 = NestedBuilder::CreateNested(std::move(innermost), 1);
-  std::unique_ptr<BasePacketBuilder> number_2 = NestedBuilder::CreateNested(std::move(number_1), 2);
-  std::unique_ptr<BasePacketBuilder> number_3 = NestedBuilder::CreateNested(std::move(number_2), 3);
-  std::unique_ptr<BasePacketBuilder> number_4 = NestedBuilder::CreateNested(std::move(number_3), 4);
-  std::unique_ptr<NestedBuilder> number_5 = NestedBuilder::CreateNested(std::move(number_4), 5);
-
-  std::vector<uint8_t> count_down{5, 4, 3, 2, 1, 0};
-  ASSERT_EQ(*number_5->FinalPacket(), count_down);
-}
-}  // namespace packets
-}  // namespace test_vendor_lib