Alex Vakulenko | e4eec20 | 2017-01-27 14:41:04 -0800 | [diff] [blame] | 1 | #include <binder/IPCThreadState.h> |
| 2 | #include <binder/IServiceManager.h> |
| 3 | #include <binder/ProcessState.h> |
Alex Vakulenko | 4fe6058 | 2017-02-02 11:35:59 -0800 | [diff] [blame] | 4 | #include <log/log.h> |
Alex Vakulenko | e4eec20 | 2017-01-27 14:41:04 -0800 | [diff] [blame] | 5 | |
Kevin Schoedel | 89af70b | 2017-03-03 18:11:37 -0500 | [diff] [blame^] | 6 | #include "VirtualTouchpadEvdev.h" |
Alex Vakulenko | e4eec20 | 2017-01-27 14:41:04 -0800 | [diff] [blame] | 7 | #include "VirtualTouchpadService.h" |
| 8 | |
| 9 | int main() { |
| 10 | ALOGI("Starting"); |
Kevin Schoedel | 89af70b | 2017-03-03 18:11:37 -0500 | [diff] [blame^] | 11 | android::dvr::VirtualTouchpadService touchpad_service( |
| 12 | android::dvr::VirtualTouchpadEvdev::Create()); |
Alex Vakulenko | e4eec20 | 2017-01-27 14:41:04 -0800 | [diff] [blame] | 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 = |
Kevin Schoedel | 89af70b | 2017-03-03 18:11:37 -0500 | [diff] [blame^] | 22 | sm->addService(android::String16(touchpad_service.SERVICE_NAME()), |
Alex Vakulenko | e4eec20 | 2017-01-27 14:41:04 -0800 | [diff] [blame] | 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 | } |