• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
main()9 int main() {
10   ALOGI("Starting");
11   android::sp<android::dvr::VirtualTouchpadService> touchpad_service =
12       new android::dvr::VirtualTouchpadService(
13           android::dvr::VirtualTouchpadEvdev::Create());
14 
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 =
23       sm->addService(android::String16(touchpad_service->SERVICE_NAME()),
24                      touchpad_service, false /*allowIsolated*/);
25   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 }
34