blob: e73f8b9b3a340662f8b03cdebdba73770a41132d [file] [log] [blame]
Alex Vakulenkoe4eec202017-01-27 14:41:04 -08001#include <binder/IPCThreadState.h>
2#include <binder/IServiceManager.h>
3#include <binder/ProcessState.h>
Alex Vakulenko4fe60582017-02-02 11:35:59 -08004#include <log/log.h>
Alex Vakulenkoe4eec202017-01-27 14:41:04 -08005
Kevin Schoedel89af70b2017-03-03 18:11:37 -05006#include "VirtualTouchpadEvdev.h"
Alex Vakulenkoe4eec202017-01-27 14:41:04 -08007#include "VirtualTouchpadService.h"
8
9int main() {
10 ALOGI("Starting");
Kevin Schoedel89af70b2017-03-03 18:11:37 -050011 android::dvr::VirtualTouchpadService touchpad_service(
12 android::dvr::VirtualTouchpadEvdev::Create());
Alex Vakulenkoe4eec202017-01-27 14:41:04 -080013
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 =
Kevin Schoedel89af70b2017-03-03 18:11:37 -050022 sm->addService(android::String16(touchpad_service.SERVICE_NAME()),
Alex Vakulenkoe4eec202017-01-27 14:41:04 -080023 &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}