diff --git a/bluetooth/1.0/default/Android.bp b/bluetooth/1.0/default/Android.bp index 4af079e462..f82bc1fedc 100644 --- a/bluetooth/1.0/default/Android.bp +++ b/bluetooth/1.0/default/Android.bp @@ -17,7 +17,6 @@ cc_library_shared { name: "android.hardware.bluetooth@1.0-impl", relative_install_path: "hw", srcs: [ - "async_fd_watcher.cc", "bluetooth_hci.cc", "bluetooth_address.cc", "vendor_interface.cc", @@ -33,12 +32,28 @@ cc_library_shared { "liblog", "libutils", ], + static_libs: [ + "android.hardware.bluetooth-async", + ], +} + +cc_library_static { + name: "android.hardware.bluetooth-async", + srcs: [ + "async_fd_watcher.cc", + ], + export_include_dirs: ["."], + shared_libs: [ + "libbase", + "libcutils", + "liblog", + "libutils", + ], } cc_test { name: "bluetooth-vendor-interface-unit-tests", srcs: [ - "async_fd_watcher.cc", "test/async_fd_watcher_unittest.cc", ], local_include_dirs: [ @@ -48,6 +63,9 @@ cc_test { "libbase", "liblog", ], + static_libs: [ + "android.hardware.bluetooth-async", + ], } cc_test_host { diff --git a/bluetooth/1.0/default/async_fd_watcher.cc b/bluetooth/1.0/default/async_fd_watcher.cc index 161a74a05c..a88aa275c9 100644 --- a/bluetooth/1.0/default/async_fd_watcher.cc +++ b/bluetooth/1.0/default/async_fd_watcher.cc @@ -29,8 +29,7 @@ namespace android { namespace hardware { namespace bluetooth { -namespace V1_0 { -namespace implementation { +namespace async { int AsyncFdWatcher::WatchFdForNonBlockingReads( int file_descriptor, const ReadCallback& on_read_fd_ready_callback) { @@ -167,8 +166,7 @@ void AsyncFdWatcher::ThreadRoutine() { } } -} // namespace implementation -} // namespace V1_0 +} // namespace async } // namespace bluetooth } // namespace hardware } // namespace android diff --git a/bluetooth/1.0/default/async_fd_watcher.h b/bluetooth/1.0/default/async_fd_watcher.h index d6e112fd68..3f7ff544ed 100644 --- a/bluetooth/1.0/default/async_fd_watcher.h +++ b/bluetooth/1.0/default/async_fd_watcher.h @@ -22,8 +22,7 @@ namespace android { namespace hardware { namespace bluetooth { -namespace V1_0 { -namespace implementation { +namespace async { using ReadCallback = std::function; using TimeoutCallback = std::function; @@ -62,8 +61,7 @@ class AsyncFdWatcher { }; -} // namespace implementation -} // namespace V1_0 +} // namespace async } // namespace bluetooth } // namespace hardware } // namespace android diff --git a/bluetooth/1.0/default/test/async_fd_watcher_unittest.cc b/bluetooth/1.0/default/test/async_fd_watcher_unittest.cc index 49ea44abb4..a7f5bdab02 100644 --- a/bluetooth/1.0/default/test/async_fd_watcher_unittest.cc +++ b/bluetooth/1.0/default/test/async_fd_watcher_unittest.cc @@ -33,6 +33,8 @@ namespace bluetooth { namespace V1_0 { namespace implementation { +using android::hardware::bluetooth::async::AsyncFdWatcher; + class AsyncFdWatcherSocketTest : public ::testing::Test { public: static const uint16_t kPort = 6111; diff --git a/bluetooth/1.0/default/vendor_interface.h b/bluetooth/1.0/default/vendor_interface.h index ce5769cb7e..98357f573d 100644 --- a/bluetooth/1.0/default/vendor_interface.h +++ b/bluetooth/1.0/default/vendor_interface.h @@ -59,7 +59,7 @@ class VendorInterface { void *lib_handle_; bt_vendor_interface_t *lib_interface_; - AsyncFdWatcher fd_watcher_; + async::AsyncFdWatcher fd_watcher_; int uart_fd_; PacketReadCallback packet_read_cb_; InitializeCompleteCallback initialize_complete_cb_;