blob: db3f92d8870b6148e11a394496f4c4fb1a1fa373 [file] [log] [blame]
Jan Altensene0dd3292020-02-01 06:21:33 +01001/*
2 * Copyright (C) 2020 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.power@1.0-service.exynos"
18
19#include <android-base/logging.h>
20#include <hidl/HidlTransportSupport.h>
21#include <utils/Errors.h>
22
23#include "Power.h"
24
25using android::hardware::configureRpcThreadpool;
26using android::hardware::joinRpcThreadpool;
27
28using android::hardware::power::V1_0::IPower;
29using android::hardware::power::V1_0::implementation::Power;
30
31using android::OK;
32using android::sp;
33using android::status_t;
34
35int main() {
36 sp<Power> power = new Power();
37 status_t status = 0;
38
39 configureRpcThreadpool(1, true);
40
41 status = power->IPower::registerAsService();
42 if (status != OK) {
43 LOG(ERROR) << "Could not register service (IPower) for Power HAL";
44 goto shutdown;
45 }
46
47 status = power->ILineagePower::registerAsService();
48 if (status != OK) {
49 LOG(ERROR) << "Could not register service (ILineagePower) for Power HAL";
50 goto shutdown;
51 }
52
53 LOG(INFO) << "Power HAL service is Ready.";
54 joinRpcThreadpool();
55
56shutdown:
57 // In normal operation, we don't expect the thread pool to shutdown
58 LOG(ERROR) << "Power HAL failed to join thread pool.";
59 return 1;
60}