main.cpp revision de1cdaebc9b8fdbc5348e6c07f849b74bacc485d
1#include <binder/IPCThreadState.h> 2#include <binder/IServiceManager.h> 3#include <binder/ProcessState.h> 4#include <log/log.h> 5 6#include "VirtualTouchpadEvdev.h" 7#include "VirtualTouchpadService.h" 8 9int main() { 10 ALOGI("Starting"); 11 android::dvr::VirtualTouchpadService touchpad_service( 12 std::move(android::dvr::VirtualTouchpadEvdev::Create())); 13 14 signal(SIGPIPE, SIG_IGN); 15 android::sp<android::ProcessState> ps(android::ProcessState::self()); 16 ps->setThreadPoolMaxThreadCount(4); 17 ps->startThreadPool(); 18 ps->giveThreadPoolName(); 19 20 android::sp<android::IServiceManager> sm(android::defaultServiceManager()); 21 const android::status_t service_status = 22 sm->addService(android::String16(touchpad_service.SERVICE_NAME()), 23 &touchpad_service, false /*allowIsolated*/); 24 if (service_status != android::OK) { 25 ALOGE("virtual touchpad service not added: %d", 26 static_cast<int>(service_status)); 27 exit(2); 28 } 29 30 android::IPCThreadState::self()->joinThreadPool(); 31 return 0; 32} 33