diff --git a/livedisplay/AdaptiveBacklight.cpp b/livedisplay/AdaptiveBacklight.cpp deleted file mode 100644 index 94ed2fc..0000000 --- a/livedisplay/AdaptiveBacklight.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2019-2022 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 "AdaptiveBacklight.h" - -#include -#include -#include - -using ::android::base::GetBoolProperty; -using ::android::base::ReadFileToString; -using ::android::base::Trim; -using ::android::base::WriteStringToFile; - -namespace { - constexpr const char *kFileAcl = "/sys/devices/platform/soc/soc:qcom,dsi-display-primary/dsi_display_acl"; - constexpr const char *kFileCabc = "/sys/devices/platform/soc/soc:qcom,dsi-display-primary/dsi_display_cabc"; - constexpr const char *kFossProperty = "ro.vendor.display.foss"; -} // anonymous namespace - -namespace vendor { -namespace lineage { -namespace livedisplay { -namespace V2_1 { -namespace implementation { - -AdaptiveBacklight::AdaptiveBacklight() { - if (!access(kFileAcl, R_OK | W_OK)) { - file_ = kFileAcl; - } else if (!access(kFileCabc, R_OK | W_OK)) { - file_ = kFileCabc; - } else { - file_ = nullptr; - } -} - -bool AdaptiveBacklight::isSupported() { - if (GetBoolProperty(kFossProperty, false) || file_ == nullptr) { - return false; - } - return true; -} - -// Methods from ::vendor::lineage::livedisplay::V2_1::IAdaptiveBacklight follow. -Return AdaptiveBacklight::isEnabled() { - std::string tmp; - int32_t contents = 0; - - if (ReadFileToString(file_, &tmp)) { - contents = std::stoi(Trim(tmp)); - } - - return contents > 0; -} - -Return AdaptiveBacklight::setEnabled(bool enabled) { - return WriteStringToFile(std::to_string(enabled), file_, true); -} - -} // namespace implementation -} // namespace V2_1 -} // namespace livedisplay -} // namespace lineage -} // namespace vendor diff --git a/livedisplay/AdaptiveBacklight.h b/livedisplay/AdaptiveBacklight.h deleted file mode 100644 index e47c935..0000000 --- a/livedisplay/AdaptiveBacklight.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2019-2022 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. - */ - -#pragma once - -#include - -namespace vendor { -namespace lineage { -namespace livedisplay { -namespace V2_1 { -namespace implementation { - -using ::android::hardware::Return; - -class AdaptiveBacklight : public IAdaptiveBacklight { - public: - AdaptiveBacklight(); - bool isSupported(); - - // Methods from ::vendor::lineage::livedisplay::V2_1::IAdaptiveBacklight follow. - Return isEnabled() override; - Return setEnabled(bool enabled) override; - - private: - const char* file_; -}; - -} // namespace implementation -} // namespace V2_1 -} // namespace livedisplay -} // namespace lineage -} // namespace vendor diff --git a/livedisplay/Android.bp b/livedisplay/Android.bp index 3b9426a..3054f94 100644 --- a/livedisplay/Android.bp +++ b/livedisplay/Android.bp @@ -19,7 +19,6 @@ cc_defaults { srcs: [ ":vendor.lineage.livedisplay@2.0-sdm-pa", ":vendor.lineage.livedisplay@2.0-sdm-utils", - "AdaptiveBacklight.cpp", "AntiFlicker.cpp", "SunlightEnhancement.cpp", "service.cpp", diff --git a/livedisplay/service.cpp b/livedisplay/service.cpp index 3ad7ff7..b287cb5 100644 --- a/livedisplay/service.cpp +++ b/livedisplay/service.cpp @@ -21,7 +21,6 @@ #include #include #include -#include "AdaptiveBacklight.h" #include "AntiFlicker.h" #include "SunlightEnhancement.h" @@ -34,23 +33,12 @@ using ::android::hardware::joinRpcThreadpool; using ::vendor::lineage::livedisplay::V2_0::sdm::PictureAdjustment; using ::vendor::lineage::livedisplay::V2_0::sdm::SDMController; using ::vendor::lineage::livedisplay::V2_1::IPictureAdjustment; -using ::vendor::lineage::livedisplay::V2_1::implementation::AdaptiveBacklight; using ::vendor::lineage::livedisplay::V2_1::implementation::AntiFlicker; using ::vendor::lineage::livedisplay::V2_1::implementation::SunlightEnhancement; status_t RegisterAsServices() { status_t status = OK; - sp ab = new AdaptiveBacklight(); - if (ab->isSupported()) { - status = ab->registerAsService(); - if (status != OK) { - LOG(ERROR) << "Could not register service for LiveDisplay HAL AdaptiveBacklight Iface (" - << status << ")"; - return status; - } - } - sp se = new SunlightEnhancement(); if (se->isSupported()) { status = se->registerAsService(); diff --git a/livedisplay/vendor.lineage.livedisplay@2.1-service.motorola_lahaina.rc b/livedisplay/vendor.lineage.livedisplay@2.1-service.motorola_lahaina.rc index 34e2f81..a039511 100644 --- a/livedisplay/vendor.lineage.livedisplay@2.1-service.motorola_lahaina.rc +++ b/livedisplay/vendor.lineage.livedisplay@2.1-service.motorola_lahaina.rc @@ -1,9 +1,5 @@ on init # LiveDisplay sysfs - chown system system /sys/devices/platform/soc/soc:qcom,dsi-display-primary/dsi_display_acl - chmod 0660 /sys/devices/platform/soc/soc:qcom,dsi-display-primary/dsi_display_acl - chown system system /sys/devices/platform/soc/soc:qcom,dsi-display-primary/dsi_display_cabc - chmod 0660 /sys/devices/platform/soc/soc:qcom,dsi-display-primary/dsi_display_cabc chown system system /sys/devices/platform/soc/soc:qcom,dsi-display-primary/dsi_display_hbm chmod 0660 /sys/devices/platform/soc/soc:qcom,dsi-display-primary/dsi_display_hbm chown system system /sys/devices/platform/soc/soc:qcom,dsi-display-primary/dsi_display_dc diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts index ba509df..2851c3c 100644 --- a/sepolicy/vendor/genfs_contexts +++ b/sepolicy/vendor/genfs_contexts @@ -8,8 +8,6 @@ genfscon sysfs /devices/virtual/input genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm8350c@2:qcom,leds@ef00/leds/charging u:object_r:sysfs_leds:s0 # LiveDisplay -genfscon sysfs /devices/platform/soc/soc:qcom,dsi-display-primary/dsi_display_acl u:object_r:sysfs_livedisplay_tuneable:s0 -genfscon sysfs /devices/platform/soc/soc:qcom,dsi-display-primary/dsi_display_cabc u:object_r:sysfs_livedisplay_tuneable:s0 genfscon sysfs /devices/platform/soc/soc:qcom,dsi-display-primary/dsi_display_hbm u:object_r:sysfs_livedisplay_tuneable:s0 genfscon sysfs /devices/platform/soc/soc:qcom,dsi-display-primary/dsi_display_dc u:object_r:sysfs_livedisplay_tuneable:s0