Steven Moreland | 08484f8 | 2016-10-14 12:27:48 -0700 | [diff] [blame^] | 1 | #define LOG_TAG "android.hardware.light@2.0-service" |
| 2 | #include <utils/Log.h> |
| 3 | |
| 4 | // #include <iostream> |
| 5 | // #include <unistd.h> |
| 6 | |
| 7 | // #include <hidl/IServiceManager.h> |
| 8 | // #include <hwbinder/IPCThreadState.h> |
| 9 | // #include <hwbinder/ProcessState.h> |
| 10 | // #include <utils/Errors.h> |
| 11 | // #include <utils/StrongPointer.h> |
| 12 | |
| 13 | #include "Light.h" |
| 14 | |
| 15 | using android::sp; |
| 16 | |
| 17 | // libhwbinder: |
| 18 | using android::hardware::IPCThreadState; |
| 19 | using android::hardware::ProcessState; |
| 20 | |
| 21 | // Generated HIDL files |
| 22 | using android::hardware::light::V2_0::ILight; |
| 23 | |
| 24 | int main() { |
| 25 | const char instance[] = "light"; |
| 26 | |
| 27 | android::sp<ILight> service = new Light(); |
| 28 | |
| 29 | service->registerAsService(instance); |
| 30 | |
| 31 | ProcessState::self()->setThreadPoolMaxThreadCount(0); |
| 32 | ProcessState::self()->startThreadPool(); |
| 33 | IPCThreadState::self()->joinThreadPool(); |
| 34 | } |