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 | edf0967 | 2017-04-07 13:17:53 -0400 | [diff] [blame] | 11 | android::sp<android::dvr::VirtualTouchpadService> touchpad_service = |
| 12 | new android::dvr::VirtualTouchpadService( |
| 13 | android::dvr::VirtualTouchpadEvdev::Create()); |
Alex Vakulenko | e4eec20 | 2017-01-27 14:41:04 -0800 | [diff] [blame] | 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 = |
Kevin Schoedel | edf0967 | 2017-04-07 13:17:53 -0400 | [diff] [blame] | 23 | sm->addService(android::String16(touchpad_service->SERVICE_NAME()), |
| 24 | touchpad_service, false /*allowIsolated*/); |
Alex Vakulenko | e4eec20 | 2017-01-27 14:41:04 -0800 | [diff] [blame] | 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 | } |