Alexander Koskovich | 5bee99d | 2021-08-01 21:40:55 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2020 The Android Open Source Project |
| 3 | * SPDX-License-Identifier: Apache-2.0 |
| 4 | */ |
| 5 | |
| 6 | #include "Lights.h" |
| 7 | #include <android-base/logging.h> |
| 8 | #include <android/binder_manager.h> |
| 9 | #include <android/binder_process.h> |
| 10 | |
| 11 | using ::aidl::android::hardware::light::Lights; |
| 12 | |
| 13 | int main() { |
| 14 | ABinderProcess_setThreadPoolMaxThreadCount(0); |
| 15 | std::shared_ptr<Lights> lights = ndk::SharedRefBase::make<Lights>(); |
| 16 | if (!lights) { |
| 17 | return EXIT_FAILURE; |
| 18 | } |
| 19 | |
| 20 | const std::string instance = std::string() + Lights::descriptor + "/default"; |
| 21 | binder_status_t status = AServiceManager_addService(lights->asBinder().get(), instance.c_str()); |
| 22 | CHECK(status == STATUS_OK); |
| 23 | |
| 24 | ABinderProcess_joinThreadPool(); |
| 25 | return EXIT_FAILURE; // should not reached |
| 26 | } |