diff options
author | dianlujitao <dianlujitao@lineageos.org> | 2020-02-06 23:02:18 +0800 |
---|---|---|
committer | Michael Bestas <mkbestas@lineageos.org> | 2020-04-30 00:49:34 +0300 |
commit | c279339ab927e2bdb77aa42973ef3e320c025364 (patch) | |
tree | e0792b6e068209cc5bb2a5f12aa3039a625fba6d /light/service.cpp | |
parent | 938bdfae0a0a69e765d39121ba18de111df28eaa (diff) |
sdm660-common: Improve lights HAL
* Use libbase logging and file utils
* Read max brightness from sysfs
* Convert constants to constexpr
* Move helper functions to anonymous namespace
* Bug fixes
* Remove redundant chmod
* Start the service after permissions are set up because it reads max
brightness in constructor.
Change-Id: I145d393c785e182060c5651e796d489f8c4d697b
[SQUASHME] Let's dejank paths a bit...
Change-Id: Ifd3d05588b0271e7a361aa4c7374a91fe5639a1f
Diffstat (limited to 'light/service.cpp')
-rw-r--r-- | light/service.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/light/service.cpp b/light/service.cpp index 8f6fa88..27a4ebf 100644 --- a/light/service.cpp +++ b/light/service.cpp @@ -1,5 +1,6 @@ /* - * Copyright 2018 The Android Open Source Project + * Copyright (C) 2018 The Android Open Source Project + * Copyright (C) 2020 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +17,7 @@ #define LOG_TAG "android.hardware.light@2.0-service.xiaomi_sdm660" +#include <android-base/logging.h> #include <hidl/HidlTransportSupport.h> #include "Light.h" @@ -23,28 +25,26 @@ using android::hardware::configureRpcThreadpool; using android::hardware::joinRpcThreadpool; -using android::hardware::light::V2_0::ILight; using android::hardware::light::V2_0::implementation::Light; using android::OK; -using android::sp; using android::status_t; int main() { - android::sp<ILight> service = new Light(); + android::sp<Light> service = new Light(); configureRpcThreadpool(1, true); status_t status = service->registerAsService(); if (status != OK) { - ALOGE("Cannot register Light HAL service."); + LOG(ERROR) << "Cannot register Light HAL service."; return 1; } - ALOGI("Light HAL service ready."); + LOG(DEBUG) << "Light HAL service ready."; joinRpcThreadpool(); - ALOGI("Light HAL service failed to join thread pool."); + LOG(ERROR) << "Light HAL service failed to join thread pool."; return 1; } |