diff --git a/nfc/1.0/default/service.cpp b/nfc/1.0/default/service.cpp index e70388d0ab..32f9c286bb 100644 --- a/nfc/1.0/default/service.cpp +++ b/nfc/1.0/default/service.cpp @@ -1,44 +1,13 @@ #define LOG_TAG "android.hardware.nfc@1.0-service" -#include - -#include -#include #include -#include -#include -#include -#include -#include - -using android::sp; - -// libhwbinder: -using android::hardware::IPCThreadState; -using android::hardware::ProcessState; +#include // Generated HIDL files using android::hardware::nfc::V1_0::INfc; +using android::hardware::defaultPassthroughServiceImplementation; int main() { - ALOGI("Service is starting."); - const char instance[] = "nfc_nci"; - ALOGI("Retrieving default implementation of instance %s.", - instance); - android::sp service = INfc::getService(instance, true /* getStub */); - if (service.get() == nullptr) { - ALOGE("INfc::getService returned NULL, exiting"); - return -1; - } - ALOGI("Default implementation using %s is %s", - instance, (service->isRemote() ? "REMOTE" : "LOCAL")); - LOG_FATAL_IF(service->isRemote(), "Implementation is REMOTE!"); - ALOGI("Registering instance %s.", instance); - service->registerAsService(instance); - ALOGI("Ready."); - - ProcessState::self()->setThreadPoolMaxThreadCount(0); - ProcessState::self()->startThreadPool(); - IPCThreadState::self()->joinThreadPool(); + return defaultPassthroughServiceImplementation("nfc_nci"); }