blob: 55ac9bf764c76d9a726cf0848ee5cc6fcb2bb21e [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 Schoedeledf09672017-04-07 13:17:53 -040011 android::sp<android::dvr::VirtualTouchpadService> touchpad_service =
12 new android::dvr::VirtualTouchpadService(
13 android::dvr::VirtualTouchpadEvdev::Create());
Alex Vakulenkoe4eec202017-01-27 14:41:04 -080014
15 signal(SIGPIPE, SIG_IGN);
16 android::sp<android::ProcessState> ps(android::ProcessState::self());
17 ps->setThreadPoolMaxThreadCount(4);
18 ps->startThreadPool();
19 ps->giveThreadPoolName();
20
21 android::sp<android::IServiceManager> sm(android::defaultServiceManager());
22 const android::status_t service_status =
Kevin Schoedeledf09672017-04-07 13:17:53 -040023 sm->addService(android::String16(touchpad_service->SERVICE_NAME()),
24 touchpad_service, false /*allowIsolated*/);
Alex Vakulenkoe4eec202017-01-27 14:41:04 -080025 if (service_status != android::OK) {
26 ALOGE("virtual touchpad service not added: %d",
27 static_cast<int>(service_status));
28 exit(2);
29 }
30
31 android::IPCThreadState::self()->joinThreadPool();
32 return 0;
33}