* Change default ::implementation namespace to ::samsung * Fill in required methods for used impls * Cleanup passthrough code for used impls * Remove unused impls * Add and setup binderized service Change-Id: I545a7c0ac8bf4fce04da73a0d39d4ac1938496f2tirimbino
parent
1a8433638a
commit
4e47a0bc91
@ -1,47 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2019 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. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
#include "AutoContrast.h" |
||||
|
||||
namespace vendor { |
||||
namespace lineage { |
||||
namespace livedisplay { |
||||
namespace V2_0 { |
||||
namespace implementation { |
||||
|
||||
// Methods from ::vendor::lineage::livedisplay::V2_0::IAutoContrast follow.
|
||||
Return<bool> AutoContrast::isEnabled() { |
||||
// TODO implement
|
||||
return bool {}; |
||||
} |
||||
|
||||
Return<bool> AutoContrast::setEnabled(bool enabled) { |
||||
// TODO implement
|
||||
return bool {}; |
||||
} |
||||
|
||||
|
||||
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
||||
|
||||
//IAutoContrast* HIDL_FETCH_IAutoContrast(const char* /* name */) {
|
||||
//return new AutoContrast();
|
||||
//}
|
||||
//
|
||||
} // namespace implementation
|
||||
} // namespace V2_0
|
||||
} // namespace livedisplay
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
@ -1,52 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2019 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. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
#include "ColorBalance.h" |
||||
|
||||
namespace vendor { |
||||
namespace lineage { |
||||
namespace livedisplay { |
||||
namespace V2_0 { |
||||
namespace implementation { |
||||
|
||||
// Methods from ::vendor::lineage::livedisplay::V2_0::IColorBalance follow.
|
||||
Return<void> ColorBalance::getColorBalanceRange(getColorBalanceRange_cb _hidl_cb) { |
||||
// TODO implement
|
||||
return Void(); |
||||
} |
||||
|
||||
Return<int32_t> ColorBalance::getColorBalance() { |
||||
// TODO implement
|
||||
return int32_t {}; |
||||
} |
||||
|
||||
Return<bool> ColorBalance::setColorBalance(int32_t value) { |
||||
// TODO implement
|
||||
return bool {}; |
||||
} |
||||
|
||||
|
||||
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
||||
|
||||
//IColorBalance* HIDL_FETCH_IColorBalance(const char* /* name */) {
|
||||
//return new ColorBalance();
|
||||
//}
|
||||
//
|
||||
} // namespace implementation
|
||||
} // namespace V2_0
|
||||
} // namespace livedisplay
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
@ -1,57 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2019 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. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
#ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_0_COLORBALANCE_H |
||||
#define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_COLORBALANCE_H |
||||
|
||||
#include <vendor/lineage/livedisplay/2.0/IColorBalance.h> |
||||
#include <hidl/MQDescriptor.h> |
||||
#include <hidl/Status.h> |
||||
|
||||
namespace vendor { |
||||
namespace lineage { |
||||
namespace livedisplay { |
||||
namespace V2_0 { |
||||
namespace implementation { |
||||
|
||||
using ::android::hardware::hidl_array; |
||||
using ::android::hardware::hidl_memory; |
||||
using ::android::hardware::hidl_string; |
||||
using ::android::hardware::hidl_vec; |
||||
using ::android::hardware::Return; |
||||
using ::android::hardware::Void; |
||||
using ::android::sp; |
||||
|
||||
struct ColorBalance : public IColorBalance { |
||||
// Methods from ::vendor::lineage::livedisplay::V2_0::IColorBalance follow.
|
||||
Return<void> getColorBalanceRange(getColorBalanceRange_cb _hidl_cb) override; |
||||
Return<int32_t> getColorBalance() override; |
||||
Return<bool> setColorBalance(int32_t value) override; |
||||
|
||||
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
||||
|
||||
}; |
||||
|
||||
// FIXME: most likely delete, this is only for passthrough implementations
|
||||
// extern "C" IColorBalance* HIDL_FETCH_IColorBalance(const char* name);
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V2_0
|
||||
} // namespace livedisplay
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
|
||||
#endif // VENDOR_LINEAGE_LIVEDISPLAY_V2_0_COLORBALANCE_H
|
@ -1,47 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2019 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. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
#include "ColorEnhancement.h" |
||||
|
||||
namespace vendor { |
||||
namespace lineage { |
||||
namespace livedisplay { |
||||
namespace V2_0 { |
||||
namespace implementation { |
||||
|
||||
// Methods from ::vendor::lineage::livedisplay::V2_0::IColorEnhancement follow.
|
||||
Return<bool> ColorEnhancement::isEnabled() { |
||||
// TODO implement
|
||||
return bool {}; |
||||
} |
||||
|
||||
Return<bool> ColorEnhancement::setEnabled(bool enabled) { |
||||
// TODO implement
|
||||
return bool {}; |
||||
} |
||||
|
||||
|
||||
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
||||
|
||||
//IColorEnhancement* HIDL_FETCH_IColorEnhancement(const char* /* name */) {
|
||||
//return new ColorEnhancement();
|
||||
//}
|
||||
//
|
||||
} // namespace implementation
|
||||
} // namespace V2_0
|
||||
} // namespace livedisplay
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
@ -0,0 +1,77 @@ |
||||
/*
|
||||
* Copyright (C) 2019 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. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
#include <android-base/file.h> |
||||
#include <android-base/strings.h> |
||||
|
||||
#include <fstream> |
||||
|
||||
#include "DisplayColorCalibrationExynos.h" |
||||
|
||||
using android::base::ReadFileToString; |
||||
using android::base::Split; |
||||
using android::base::Trim; |
||||
using android::base::WriteStringToFile; |
||||
|
||||
namespace vendor { |
||||
namespace lineage { |
||||
namespace livedisplay { |
||||
namespace V2_0 { |
||||
namespace samsung { |
||||
|
||||
static constexpr const char *kColorPath = "/sys/class/mdnie/mdnie/sensorRGB"; |
||||
|
||||
bool DisplayColorCalibrationExynos::isSupported() { |
||||
std::fstream rgb(kColorPath, rgb.in | rgb.out); |
||||
return rgb.good(); |
||||
} |
||||
|
||||
Return<int32_t> DisplayColorCalibrationExynos::getMaxValue() { |
||||
return 255; |
||||
} |
||||
|
||||
Return<int32_t> DisplayColorCalibrationExynos::getMinValue() { |
||||
return 1; |
||||
} |
||||
|
||||
Return<void> DisplayColorCalibrationExynos::getCalibration(getCalibration_cb resultCb) { |
||||
std::vector<int32_t> rgb; |
||||
std::string tmp; |
||||
|
||||
if (ReadFileToString(kColorPath, &tmp)) { |
||||
std::vector<std::string> colors = Split(Trim(tmp), " "); |
||||
for (const std::string& color : colors) { |
||||
rgb.push_back(std::stoi(color)); |
||||
} |
||||
} |
||||
|
||||
resultCb(rgb); |
||||
return Void(); |
||||
} |
||||
|
||||
Return<bool> DisplayColorCalibrationExynos::setCalibration(const hidl_vec<int32_t>& rgb) { |
||||
std::string contents; |
||||
for (const int32_t& color : rgb) { |
||||
contents += std::to_string(color) + " "; |
||||
} |
||||
return WriteStringToFile(Trim(contents), kColorPath, true); |
||||
} |
||||
|
||||
} // namespace samsung
|
||||
} // namespace V2_0
|
||||
} // namespace livedisplay
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
@ -1,77 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2019 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. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
#include "PictureAdjustment.h" |
||||
|
||||
namespace vendor { |
||||
namespace lineage { |
||||
namespace livedisplay { |
||||
namespace V2_0 { |
||||
namespace implementation { |
||||
|
||||
// Methods from ::vendor::lineage::livedisplay::V2_0::IPictureAdjustment follow.
|
||||
Return<void> PictureAdjustment::getHueRange(getHueRange_cb _hidl_cb) { |
||||
// TODO implement
|
||||
return Void(); |
||||
} |
||||
|
||||
Return<void> PictureAdjustment::getSaturationRange(getSaturationRange_cb _hidl_cb) { |
||||
// TODO implement
|
||||
return Void(); |
||||
} |
||||
|
||||
Return<void> PictureAdjustment::getIntensityRange(getIntensityRange_cb _hidl_cb) { |
||||
// TODO implement
|
||||
return Void(); |
||||
} |
||||
|
||||
Return<void> PictureAdjustment::getContrastRange(getContrastRange_cb _hidl_cb) { |
||||
// TODO implement
|
||||
return Void(); |
||||
} |
||||
|
||||
Return<void> PictureAdjustment::getSaturationThresholdRange(getSaturationThresholdRange_cb _hidl_cb) { |
||||
// TODO implement
|
||||
return Void(); |
||||
} |
||||
|
||||
Return<void> PictureAdjustment::getPictureAdjustment(getPictureAdjustment_cb _hidl_cb) { |
||||
// TODO implement
|
||||
return Void(); |
||||
} |
||||
|
||||
Return<void> PictureAdjustment::getDefaultPictureAdjustment(getDefaultPictureAdjustment_cb _hidl_cb) { |
||||
// TODO implement
|
||||
return Void(); |
||||
} |
||||
|
||||
Return<bool> PictureAdjustment::setPictureAdjustment(const ::vendor::lineage::livedisplay::V2_0::HSIC& hsic) { |
||||
// TODO implement
|
||||
return bool {}; |
||||
} |
||||
|
||||
|
||||
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
||||
|
||||
//IPictureAdjustment* HIDL_FETCH_IPictureAdjustment(const char* /* name */) {
|
||||
//return new PictureAdjustment();
|
||||
//}
|
||||
//
|
||||
} // namespace implementation
|
||||
} // namespace V2_0
|
||||
} // namespace livedisplay
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
@ -1,62 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2019 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. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
#ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_0_PICTUREADJUSTMENT_H |
||||
#define VENDOR_LINEAGE_LIVEDISPLAY_V2_0_PICTUREADJUSTMENT_H |
||||
|
||||
#include <vendor/lineage/livedisplay/2.0/IPictureAdjustment.h> |
||||
#include <hidl/MQDescriptor.h> |
||||
#include <hidl/Status.h> |
||||
|
||||
namespace vendor { |
||||
namespace lineage { |
||||
namespace livedisplay { |
||||
namespace V2_0 { |
||||
namespace implementation { |
||||
|
||||
using ::android::hardware::hidl_array; |
||||
using ::android::hardware::hidl_memory; |
||||
using ::android::hardware::hidl_string; |
||||
using ::android::hardware::hidl_vec; |
||||
using ::android::hardware::Return; |
||||
using ::android::hardware::Void; |
||||
using ::android::sp; |
||||
|
||||
struct PictureAdjustment : public IPictureAdjustment { |
||||
// Methods from ::vendor::lineage::livedisplay::V2_0::IPictureAdjustment follow.
|
||||
Return<void> getHueRange(getHueRange_cb _hidl_cb) override; |
||||
Return<void> getSaturationRange(getSaturationRange_cb _hidl_cb) override; |
||||
Return<void> getIntensityRange(getIntensityRange_cb _hidl_cb) override; |
||||
Return<void> getContrastRange(getContrastRange_cb _hidl_cb) override; |
||||
Return<void> getSaturationThresholdRange(getSaturationThresholdRange_cb _hidl_cb) override; |
||||
Return<void> getPictureAdjustment(getPictureAdjustment_cb _hidl_cb) override; |
||||
Return<void> getDefaultPictureAdjustment(getDefaultPictureAdjustment_cb _hidl_cb) override; |
||||
Return<bool> setPictureAdjustment(const ::vendor::lineage::livedisplay::V2_0::HSIC& hsic) override; |
||||
|
||||
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
||||
|
||||
}; |
||||
|
||||
// FIXME: most likely delete, this is only for passthrough implementations
|
||||
// extern "C" IPictureAdjustment* HIDL_FETCH_IPictureAdjustment(const char* name);
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V2_0
|
||||
} // namespace livedisplay
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
|
||||
#endif // VENDOR_LINEAGE_LIVEDISPLAY_V2_0_PICTUREADJUSTMENT_H
|
@ -0,0 +1,64 @@ |
||||
/*
|
||||
* Copyright (C) 2019 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. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
#include <android-base/file.h> |
||||
#include <android-base/strings.h> |
||||
|
||||
#include <fstream> |
||||
|
||||
#include "SunlightEnhancementExynos.h" |
||||
|
||||
|
||||
using android::base::ReadFileToString; |
||||
using android::base::Trim; |
||||
using android::base::WriteStringToFile; |
||||
|
||||
namespace vendor { |
||||
namespace lineage { |
||||
namespace livedisplay { |
||||
namespace V2_0 { |
||||
namespace samsung { |
||||
|
||||
static constexpr const char *kLUXPath = "/sys/class/mdnie/mdnie/lux"; |
||||
|
||||
// Methods from ::vendor::lineage::livedisplay::V2_0::ISunlightEnhancement follow.
|
||||
bool SunlightEnhancementExynos::isSupported() { |
||||
std::fstream file(kLUXPath, file.in | file.out); |
||||
return file.good(); |
||||
} |
||||
|
||||
// Methods from ::vendor::lineage::livedisplay::V2_0::IAdaptiveBacklight follow.
|
||||
Return<bool> SunlightEnhancementExynos::isEnabled() { |
||||
std::string tmp; |
||||
int32_t contents = 0; |
||||
|
||||
if (ReadFileToString(kLUXPath, &tmp)) { |
||||
contents = std::stoi(Trim(tmp)); |
||||
} |
||||
|
||||
return contents > 0; |
||||
} |
||||
|
||||
Return<bool> SunlightEnhancementExynos::setEnabled(bool enabled) { |
||||
/* see drivers/video/fbdev/exynos/decon_7880/panels/mdnie_lite_table*, get_hbm_index */ |
||||
return WriteStringToFile(enabled ? "40000" : "0", kLUXPath, true); |
||||
} |
||||
|
||||
} // namespace samsung
|
||||
} // namespace V2_0
|
||||
} // namespace livedisplay
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
@ -0,0 +1,4 @@ |
||||
service livedisplay-hal-2-0-samsung-exynos /system/bin/hw/lineage.livedisplay@2.0-service.samsung-exynos |
||||
class hal |
||||
user system |
||||
group system |
@ -0,0 +1,4 @@ |
||||
service livedisplay-hal-2-0-samsung-qcom /system/bin/hw/lineage.livedisplay@2.0-service.samsung-qcom |
||||
class late_start |
||||
user system |
||||
group system |
@ -0,0 +1,145 @@ |
||||
/*
|
||||
* Copyright (C) 2019 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. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
#ifdef LIVES_IN_SYSTEM |
||||
#define LOG_TAG "lineage.livedisplay@2.0-service.samsung-qcom" |
||||
#else |
||||
#define LOG_TAG "vendor.lineage.livedisplay@2.0-service.samsung-qcom" |
||||
#endif |
||||
|
||||
#include <android-base/logging.h> |
||||
#include <binder/ProcessState.h> |
||||
#include <hidl/HidlTransportSupport.h> |
||||
|
||||
#include "AdaptiveBacklight.h" |
||||
#include "DisplayColorCalibration.h" |
||||
#include "DisplayModes.h" |
||||
#include "ReadingEnhancement.h" |
||||
#include "SunlightEnhancement.h" |
||||
|
||||
using android::hardware::configureRpcThreadpool; |
||||
using android::hardware::joinRpcThreadpool; |
||||
using android::sp; |
||||
using android::status_t; |
||||
using android::OK; |
||||
|
||||
using vendor::lineage::livedisplay::V2_0::samsung::AdaptiveBacklight; |
||||
using vendor::lineage::livedisplay::V2_0::samsung::DisplayColorCalibration; |
||||
using vendor::lineage::livedisplay::V2_0::samsung::DisplayModes; |
||||
using vendor::lineage::livedisplay::V2_0::samsung::ReadingEnhancement; |
||||
using vendor::lineage::livedisplay::V2_0::samsung::SunlightEnhancement; |
||||
|
||||
int main() { |
||||
sp<AdaptiveBacklight> adaptiveBacklight; |
||||
sp<DisplayColorCalibration> displayColorCalibration; |
||||
sp<DisplayModes> displayModes; |
||||
sp<ReadingEnhancement> readingEnhancement; |
||||
sp<SunlightEnhancement> sunlightEnhancement; |
||||
status_t status; |
||||
|
||||
LOG(INFO) << "LiveDisplay HAL service is starting."; |
||||
|
||||
adaptiveBacklight = new AdaptiveBacklight(); |
||||
if (adaptiveBacklight == nullptr) { |
||||
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL AdaptiveBacklight Iface, exiting."; |
||||
goto shutdown; |
||||
} |
||||
|
||||
displayColorCalibration = new DisplayColorCalibration(); |
||||
if (displayColorCalibration == nullptr) { |
||||
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL DisplayColorCalibration Iface, exiting."; |
||||
goto shutdown; |
||||
} |
||||
|
||||
displayModes = new DisplayModes(); |
||||
if (displayModes == nullptr) { |
||||
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL DisplayModes Iface, exiting."; |
||||
goto shutdown; |
||||
} |
||||
|
||||
readingEnhancement = new ReadingEnhancement(); |
||||
if (readingEnhancement == nullptr) { |
||||
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL ReadingEnhancement Iface, exiting."; |
||||
goto shutdown; |
||||
} |
||||
|
||||
sunlightEnhancement = new SunlightEnhancement(); |
||||
if (sunlightEnhancement == nullptr) { |
||||
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL SunlightEnhancement Iface, exiting."; |
||||
goto shutdown; |
||||
} |
||||
|
||||
configureRpcThreadpool(1, true /*callerWillJoin*/); |
||||
|
||||
if (adaptiveBacklight->isSupported()) { |
||||
status = adaptiveBacklight->registerAsService(); |
||||
if (status != OK) { |
||||
LOG(ERROR) |
||||
<< "Could not register service for LiveDisplay HAL AdaptiveBacklight Iface (" |
||||
<< status << ")"; |
||||
goto shutdown; |
||||
} |
||||
} |
||||
|
||||
if (displayColorCalibration->isSupported()) { |
||||
status = displayColorCalibration->registerAsService(); |
||||
if (status != OK) { |
||||
LOG(ERROR) |
||||
<< "Could not register service for LiveDisplay HAL DisplayColorCalibration Iface (" |
||||
<< status << ")"; |
||||
goto shutdown; |
||||
} |
||||
} |
||||
|
||||
if (displayModes->isSupported()) { |
||||
status = displayModes->registerAsService(); |
||||
if (status != OK) { |
||||
LOG(ERROR) |
||||
<< "Could not register service for LiveDisplay HAL DisplayModes Iface (" |
||||
<< status << ")"; |
||||
goto shutdown; |
||||
} |
||||
} |
||||
|
||||
if (readingEnhancement->isSupported()) { |
||||
status = readingEnhancement->registerAsService(); |
||||
if (status != OK) { |
||||
LOG(ERROR) |
||||
<< "Could not register service for LiveDisplay HAL ReadingEnhancement Iface (" |
||||
<< status << ")"; |
||||
goto shutdown; |
||||
} |
||||
} |
||||
|
||||
if (sunlightEnhancement->isSupported()) { |
||||
status = sunlightEnhancement->registerAsService(); |
||||
if (status != OK) { |
||||
LOG(ERROR) |
||||
<< "Could not register service for LiveDisplay HAL SunlightEnhancement Iface (" |
||||
<< status << ")"; |
||||
goto shutdown; |
||||
} |
||||
} |
||||
|
||||
LOG(INFO) << "LiveDisplay HAL service is ready."; |
||||
joinRpcThreadpool(); |
||||
// Should not pass this line
|
||||
|
||||
shutdown: |
||||
// In normal operation, we don't expect the thread pool to shutdown
|
||||
LOG(ERROR) << "LiveDisplay HAL service is shutting down."; |
||||
return 1; |
||||
} |
@ -0,0 +1,145 @@ |
||||
/*
|
||||
* Copyright (C) 2019 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. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
#ifdef LIVES_IN_SYSTEM |
||||
#define LOG_TAG "lineage.livedisplay@2.0-service.samsung-exynos" |
||||
#else |
||||
#define LOG_TAG "vendor.lineage.livedisplay@2.0-service.samsung-exynos" |
||||
#endif |
||||
|
||||
#include <android-base/logging.h> |
||||
#include <binder/ProcessState.h> |
||||
#include <hidl/HidlTransportSupport.h> |
||||
|
||||
#include "AdaptiveBacklight.h" |
||||
#include "DisplayColorCalibrationExynos.h" |
||||
#include "DisplayModes.h" |
||||
#include "ReadingEnhancement.h" |
||||
#include "SunlightEnhancementExynos.h" |
||||
|
||||
using android::hardware::configureRpcThreadpool; |
||||
using android::hardware::joinRpcThreadpool; |
||||
using android::sp; |
||||
using android::status_t; |
||||
using android::OK; |
||||
|
||||
using vendor::lineage::livedisplay::V2_0::samsung::AdaptiveBacklight; |
||||
using vendor::lineage::livedisplay::V2_0::samsung::DisplayColorCalibrationExynos; |
||||
using vendor::lineage::livedisplay::V2_0::samsung::DisplayModes; |
||||
using vendor::lineage::livedisplay::V2_0::samsung::ReadingEnhancement; |
||||
using vendor::lineage::livedisplay::V2_0::samsung::SunlightEnhancementExynos; |
||||
|
||||
int main() { |
||||
sp<AdaptiveBacklight> adaptiveBacklight; |
||||
sp<DisplayColorCalibrationExynos> displayColorCalibrationExynos; |
||||
sp<DisplayModes> displayModes; |
||||
sp<ReadingEnhancement> readingEnhancement; |
||||
sp<SunlightEnhancementExynos> sunlightEnhancementExynos; |
||||
status_t status; |
||||
|
||||
LOG(INFO) << "LiveDisplay HAL service is starting."; |
||||
|
||||
adaptiveBacklight = new AdaptiveBacklight(); |
||||
if (adaptiveBacklight == nullptr) { |
||||
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL AdaptiveBacklight Iface, exiting."; |
||||
goto shutdown; |
||||
} |
||||
|
||||
displayColorCalibrationExynos = new DisplayColorCalibrationExynos(); |
||||
if (displayColorCalibrationExynos == nullptr) { |
||||
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL DisplayColorCalibration Iface, exiting."; |
||||
goto shutdown; |
||||
} |
||||
|
||||
displayModes = new DisplayModes(); |
||||
if (displayModes == nullptr) { |
||||
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL DisplayModes Iface, exiting."; |
||||
goto shutdown; |
||||
} |
||||
|
||||
readingEnhancement = new ReadingEnhancement(); |
||||
if (readingEnhancement == nullptr) { |
||||
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL ReadingEnhancement Iface, exiting."; |
||||
goto shutdown; |
||||
} |
||||
|
||||
sunlightEnhancementExynos = new SunlightEnhancementExynos(); |
||||
if (sunlightEnhancementExynos == nullptr) { |
||||
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL SunlightEnhancement Iface, exiting."; |
||||
goto shutdown; |
||||
} |
||||
|
||||
configureRpcThreadpool(1, true /*callerWillJoin*/); |
||||
|
||||
if (adaptiveBacklight->isSupported()) { |
||||
status = adaptiveBacklight->registerAsService(); |
||||
if (status != OK) { |
||||
LOG(ERROR) |
||||
<< "Could not register service for LiveDisplay HAL AdaptiveBacklight Iface (" |
||||
<< status << ")"; |
||||
goto shutdown; |
||||
} |
||||
} |
||||
|
||||
if (displayColorCalibrationExynos->isSupported()) { |
||||
status = displayColorCalibrationExynos->registerAsService(); |
||||
if (status != OK) { |
||||
LOG(ERROR) |
||||
<< "Could not register service for LiveDisplay HAL DisplayColorCalibration Iface (" |
||||
<< status << ")"; |
||||
goto shutdown; |
||||
} |
||||
} |
||||
|
||||
if (displayModes->isSupported()) { |
||||
status = displayModes->registerAsService(); |
||||
if (status != OK) { |
||||
LOG(ERROR) |
||||
<< "Could not register service for LiveDisplay HAL DisplayModes Iface (" |
||||
<< status << ")"; |
||||
goto shutdown; |
||||
} |
||||
} |
||||
|
||||
if (readingEnhancement->isSupported()) { |
||||
status = readingEnhancement->registerAsService(); |
||||
if (status != OK) { |
||||
LOG(ERROR) |
||||
<< "Could not register service for LiveDisplay HAL ReadingEnhancement Iface (" |
||||
<< status << ")"; |
||||
goto shutdown; |
||||
} |
||||
} |
||||
|
||||
if (sunlightEnhancementExynos->isSupported()) { |
||||
status = sunlightEnhancementExynos->registerAsService(); |
||||
if (status != OK) { |
||||
LOG(ERROR) |
||||
<< "Could not register service for LiveDisplay HAL SunlightEnhancement Iface (" |
||||
<< status << ")"; |
||||
goto shutdown; |
||||
} |
||||
} |
||||
|
||||
LOG(INFO) << "LiveDisplay HAL service is ready."; |
||||
joinRpcThreadpool(); |
||||
// Should not pass this line
|
||||
|
||||
shutdown: |
||||
// In normal operation, we don't expect the thread pool to shutdown
|
||||
LOG(ERROR) << "LiveDisplay HAL service is shutting down."; |
||||
return 1; |
||||
} |
@ -0,0 +1,4 @@ |
||||
service vendor.livedisplay-hal-2-0-samsung-exynos /vendor/bin/hw/vendor.lineage.livedisplay@2.0-service.samsung-exynos |
||||
class hal |
||||
user system |
||||
group system |
@ -0,0 +1,4 @@ |
||||
service vendor.livedisplay-hal-2-0-samsung-qcom /vendor/bin/hw/vendor.lineage.livedisplay@2.0-service.samsung-qcom |
||||
class late_start |
||||
user system |
||||
group system |
Loading…
Reference in new issue