blob: 5cc08557b90f18c22c5bd401537e572e210da3b8 [file] [log] [blame]
Jan Altensen53afa332019-07-09 22:43:47 +02001/*
2 * Copyright (C) 2019 The LineageOS 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 */
16
17#define LOG_TAG "android.hardware.light@2.0-service.samsung"
18
19#include <android-base/logging.h>
20#include <hidl/HidlTransportSupport.h>
21#include <utils/Errors.h>
22
23#include "Light.h"
24
25using android::hardware::configureRpcThreadpool;
26using android::hardware::joinRpcThreadpool;
27
28using android::hardware::light::V2_0::ILight;
29using android::hardware::light::V2_0::implementation::Light;
30
31using android::OK;
32using android::sp;
33using android::status_t;
34
35int main() {
36 sp<ILight> light = new Light();
37
38 configureRpcThreadpool(1, true);
39
40 status_t status = light->registerAsService();
41
42 if (status != OK) {
43 LOG(ERROR) << "Could not register service for Light HAL";
44 goto shutdown;
45 }
46
47 LOG(INFO) << "Light HAL service is Ready.";
48 joinRpcThreadpool();
49
50shutdown:
51 // In normal operation, we don't expect the thread pool to shutdown
52 LOG(ERROR) << "Light HAL failed to join thread pool.";
53 return 1;
54}