Steven Moreland | 9f8b5c7 | 2016-11-29 15:03:38 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Steven Moreland | 08484f8 | 2016-10-14 12:27:48 -0700 | [diff] [blame] | 16 | #define LOG_TAG "android.hardware.light@2.0-service" |
Steven Moreland | bd0db47 | 2016-11-03 08:32:56 -0700 | [diff] [blame] | 17 | |
Yifan Hong | f9d3034 | 2016-11-30 13:45:34 -0800 | [diff] [blame] | 18 | #include <android/log.h> |
Steven Moreland | 08484f8 | 2016-10-14 12:27:48 -0700 | [diff] [blame] | 19 | |
Steven Moreland | 08484f8 | 2016-10-14 12:27:48 -0700 | [diff] [blame] | 20 | #include "Light.h" |
| 21 | |
| 22 | using android::sp; |
| 23 | |
| 24 | // libhwbinder: |
| 25 | using android::hardware::IPCThreadState; |
| 26 | using android::hardware::ProcessState; |
| 27 | |
| 28 | // Generated HIDL files |
| 29 | using android::hardware::light::V2_0::ILight; |
| 30 | |
| 31 | int main() { |
| 32 | const char instance[] = "light"; |
| 33 | |
| 34 | android::sp<ILight> service = new Light(); |
| 35 | |
| 36 | service->registerAsService(instance); |
| 37 | |
| 38 | ProcessState::self()->setThreadPoolMaxThreadCount(0); |
| 39 | ProcessState::self()->startThreadPool(); |
| 40 | IPCThreadState::self()->joinThreadPool(); |
| 41 | } |