diff --git a/bluetooth/1.0/vts/functional/bluetooth_hidl_hal_test.cpp b/bluetooth/1.0/vts/functional/bluetooth_hidl_hal_test.cpp index b05e22b477..2a4bbdd817 100644 --- a/bluetooth/1.0/vts/functional/bluetooth_hidl_hal_test.cpp +++ b/bluetooth/1.0/vts/functional/bluetooth_hidl_hal_test.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -128,14 +127,6 @@ class BluetoothHidlTest : public ::testing::Test { bluetooth->isRemote() ? "remote" : "local"); ASSERT_NE(bluetooth, nullptr); - // TODO(b/31748996) A client must be completely unaware of the - // implementation details of its HAL: whether the HAL is passthrough, or - // whether it uses HWbinder or some other transport. - if (bluetooth->isRemote()) { - ::android::hardware::ProcessState::self()->setThreadPoolMaxThreadCount(1); - ::android::hardware::ProcessState::self()->startThreadPool(); - } - bluetooth_cb = new BluetoothHciCallbacks(*this); ASSERT_NE(bluetooth_cb, nullptr); diff --git a/wifi/1.0/default/service.cpp b/wifi/1.0/default/service.cpp index 751e8f6c0f..40e8b126c3 100644 --- a/wifi/1.0/default/service.cpp +++ b/wifi/1.0/default/service.cpp @@ -15,42 +15,21 @@ */ #include -#include -#include +#include #include #include #include "wifi.h" -using android::hardware::hidl_version; -using android::hardware::IPCThreadState; -using android::hardware::ProcessState; -using android::Looper; - -namespace { -int OnBinderReadReady(int /*fd*/, int /*events*/, void* /*data*/) { - IPCThreadState::self()->handlePolledCommands(); - return 1; // continue receiving events -} -} +using android::hardware::configureRpcThreadpool; +using android::hardware::joinRpcThreadpool; int main(int /*argc*/, char** argv) { android::base::InitLogging(argv, android::base::LogdLogger(android::base::SYSTEM)); LOG(INFO) << "wifi_hal_legacy is starting up..."; - // Setup binder - int binder_fd = -1; - ProcessState::self()->setThreadPoolMaxThreadCount(0); - CHECK_EQ(IPCThreadState::self()->setupPolling(&binder_fd), android::NO_ERROR) - << "Failed to initialize binder polling"; - CHECK_GE(binder_fd, 0) << "Invalid binder FD: " << binder_fd; - - // Setup looper - android::sp looper = Looper::prepare(0 /* no options */); - CHECK(looper->addFd( - binder_fd, 0, Looper::EVENT_INPUT, OnBinderReadReady, nullptr)) - << "Failed to watch binder FD"; + configureRpcThreadpool(1, true /* callerWillJoin */); // Setup hwbinder service android::sp service = @@ -58,10 +37,7 @@ int main(int /*argc*/, char** argv) { CHECK_EQ(service->registerAsService("wifi"), android::NO_ERROR) << "Failed to register wifi HAL"; - // Loop - while (looper->pollAll(-1) != Looper::POLL_ERROR) { - // Keep polling until failure. - } + joinRpcThreadpool(); LOG(INFO) << "wifi_hal_legacy is terminating..."; return 0;