diff --git a/common.mk b/common.mk index 2404782..e283161 100644 --- a/common.mk +++ b/common.mk @@ -255,10 +255,6 @@ PRODUCT_ENABLE_UFFD_GC := false PRODUCT_PACKAGES += \ android.hardware.keymaster@4.1.vendor -# LiveDisplay -PRODUCT_PACKAGES += \ - vendor.lineage.livedisplay@2.1-service.motorola_holi - # Media PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/media/init.qti.media.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qti.media.sh \ diff --git a/livedisplay/Android.bp b/livedisplay/Android.bp deleted file mode 100644 index 70d3372..0000000 --- a/livedisplay/Android.bp +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2019-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. -// 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. - -cc_defaults { - name: "livedisplay_motorola_holi", - defaults: ["hidl_defaults"], - relative_install_path: "hw", - srcs: [ - ":vendor.lineage.livedisplay@2.0-sdm-pa", - ":vendor.lineage.livedisplay@2.0-sdm-utils", - "AntiFlicker.cpp", - "SunlightEnhancement.cpp", - "service.cpp", - ], - shared_libs: [ - "libbase", - "libbinder", - "libcutils", - "libdl", - "libhidlbase", - "libutils", - "vendor.lineage.livedisplay@2.0", - "vendor.lineage.livedisplay@2.1", - ], - header_libs: [ - "vendor.lineage.livedisplay@2.0-sdm-headers", - ], -} - -cc_binary { - name: "vendor.lineage.livedisplay@2.1-service.motorola_holi", - init_rc: ["vendor.lineage.livedisplay@2.1-service.motorola_holi.rc"], - defaults: ["livedisplay_motorola_holi"], - vendor: true, -} diff --git a/livedisplay/AntiFlicker.cpp b/livedisplay/AntiFlicker.cpp deleted file mode 100644 index 3b9db40..0000000 --- a/livedisplay/AntiFlicker.cpp +++ /dev/null @@ -1,69 +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 "AntiFlicker.h" - -#include -#include - -namespace { - constexpr const char *kFileDc = "/sys/devices/platform/soc/soc:qcom,dsi-display-primary/dsi_display_dc"; -}; // anonymous namespace - -using ::android::base::ReadFileToString; -using ::android::base::Trim; -using ::android::base::WriteStringToFile; - -namespace vendor { -namespace lineage { -namespace livedisplay { -namespace V2_1 { -namespace implementation { - -AntiFlicker::AntiFlicker() { - if (!access(kFileDc, R_OK | W_OK)) { - file_ = kFileDc; - enabled_mode_ = 1; - } else { - file_ = nullptr; - } -} - -bool AntiFlicker::isSupported() { - return file_ != nullptr; -} - -// Methods from ::vendor::lineage::livedisplay::V2_1::IAntiFlicker follow. -Return AntiFlicker::isEnabled() { - std::string tmp; - int32_t contents = 0; - - if (ReadFileToString(file_, &tmp)) { - contents = std::stoi(Trim(tmp)); - } - - return contents > 0; -} - -Return AntiFlicker::setEnabled(bool enabled) { - return WriteStringToFile(enabled ? std::to_string(enabled_mode_) : "0", file_, true); -} - -} // namespace implementation -} // namespace V2_1 -} // namespace livedisplay -} // namespace lineage -} // namespace vendor diff --git a/livedisplay/AntiFlicker.h b/livedisplay/AntiFlicker.h deleted file mode 100644 index 80842f0..0000000 --- a/livedisplay/AntiFlicker.h +++ /dev/null @@ -1,47 +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 AntiFlicker : public IAntiFlicker { - public: - AntiFlicker(); - bool isSupported(); - - // Methods from ::vendor::lineage::livedisplay::V2_1::IAntiFlicker follow. - Return isEnabled() override; - Return setEnabled(bool enabled) override; - - private: - const char* file_; - int32_t enabled_mode_; -}; - -} // namespace implementation -} // namespace V2_1 -} // namespace livedisplay -} // namespace lineage -} // namespace vendor diff --git a/livedisplay/SunlightEnhancement.cpp b/livedisplay/SunlightEnhancement.cpp deleted file mode 100644 index 9b41538..0000000 --- a/livedisplay/SunlightEnhancement.cpp +++ /dev/null @@ -1,69 +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 "SunlightEnhancement.h" - -#include -#include - -namespace { - constexpr const char *kFileHbm = "/sys/devices/platform/soc/soc:qcom,dsi-display-primary/dsi_display_hbm"; -}; // anonymous namespace - -using ::android::base::ReadFileToString; -using ::android::base::Trim; -using ::android::base::WriteStringToFile; - -namespace vendor { -namespace lineage { -namespace livedisplay { -namespace V2_1 { -namespace implementation { - -SunlightEnhancement::SunlightEnhancement() { - if (!access(kFileHbm, R_OK | W_OK)) { - file_ = kFileHbm; - enabled_mode_ = 1; - } else { - file_ = nullptr; - } -} - -bool SunlightEnhancement::isSupported() { - return file_ != nullptr; -} - -// Methods from ::vendor::lineage::livedisplay::V2_1::ISunlightEnhancement follow. -Return SunlightEnhancement::isEnabled() { - std::string tmp; - int32_t contents = 0; - - if (ReadFileToString(file_, &tmp)) { - contents = std::stoi(Trim(tmp)); - } - - return contents > 0; -} - -Return SunlightEnhancement::setEnabled(bool enabled) { - return WriteStringToFile(enabled ? std::to_string(enabled_mode_) : "0", file_, true); -} - -} // namespace implementation -} // namespace V2_1 -} // namespace livedisplay -} // namespace lineage -} // namespace vendor diff --git a/livedisplay/SunlightEnhancement.h b/livedisplay/SunlightEnhancement.h deleted file mode 100644 index 73c9641..0000000 --- a/livedisplay/SunlightEnhancement.h +++ /dev/null @@ -1,47 +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 SunlightEnhancement : public ISunlightEnhancement { - public: - SunlightEnhancement(); - bool isSupported(); - - // Methods from ::vendor::lineage::livedisplay::V2_1::ISunlightEnhancement follow. - Return isEnabled() override; - Return setEnabled(bool enabled) override; - - private: - const char* file_; - int32_t enabled_mode_; -}; - -} // namespace implementation -} // namespace V2_1 -} // namespace livedisplay -} // namespace lineage -} // namespace vendor diff --git a/livedisplay/service.cpp b/livedisplay/service.cpp deleted file mode 100644 index e19eeaa..0000000 --- a/livedisplay/service.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2019-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. - * 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. - */ - -#define LOG_TAG "vendor.lineage.livedisplay@2.1-service.motorola_holi" - -#include -#include -#include -#include -#include -#include "AntiFlicker.h" -#include "SunlightEnhancement.h" - -using ::android::OK; -using ::android::sp; -using ::android::status_t; -using ::android::hardware::configureRpcThreadpool; -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::AntiFlicker; -using ::vendor::lineage::livedisplay::V2_1::implementation::SunlightEnhancement; - -status_t RegisterAsServices() { - status_t status = OK; - - sp se = new SunlightEnhancement(); - if (se->isSupported()) { - status = se->registerAsService(); - if (status != OK) { - LOG(ERROR) << "Could not register service for LiveDisplay HAL SunlightEnhancement Iface" - << " (" << status << ")"; - return status; - } - } - - sp af = new AntiFlicker(); - if (af->isSupported()) { - status = af->registerAsService(); - if (status != OK) { - LOG(ERROR) << "Could not register service for LiveDisplay HAL AntiFlicker Iface" - << " (" << status << ")"; - return status; - } - } - - std::shared_ptr controller = std::make_shared(); - sp pa = new PictureAdjustment(controller); - status = pa->registerAsService(); - if (status != OK) { - LOG(ERROR) << "Could not register service for LiveDisplay HAL PictureAdjustment Iface (" - << status << ")"; - return status; - } - - return OK; -} - -int main() { - android::ProcessState::initWithDriver("/dev/vndbinder"); - - LOG(DEBUG) << "LiveDisplay HAL service is starting."; - - configureRpcThreadpool(1, true /*callerWillJoin*/); - - if (RegisterAsServices() == OK) { - LOG(DEBUG) << "LiveDisplay HAL service is ready."; - joinRpcThreadpool(); - } else { - LOG(ERROR) << "Could not register service for LiveDisplay HAL"; - } - - // In normal operation, we don't expect the thread pool to shutdown - LOG(ERROR) << "LiveDisplay HAL service is shutting down."; - return 1; -} diff --git a/livedisplay/vendor.lineage.livedisplay@2.1-service.motorola_holi.rc b/livedisplay/vendor.lineage.livedisplay@2.1-service.motorola_holi.rc deleted file mode 100644 index 12a66b7..0000000 --- a/livedisplay/vendor.lineage.livedisplay@2.1-service.motorola_holi.rc +++ /dev/null @@ -1,11 +0,0 @@ -on init - # LiveDisplay sysfs - 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 - chmod 0660 /sys/devices/platform/soc/soc:qcom,dsi-display-primary/dsi_display_dc - -service vendor.livedisplay-hal-2-1 /vendor/bin/hw/vendor.lineage.livedisplay@2.1-service.motorola_holi - class late_start - user system - group system diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index 11f3e80..718881a 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -64,9 +64,6 @@ # Label read_ahead_kb in /data partition /sys/devices/platform/soc/1d84000.ufshc/host0/target0:0:0/0:0:0:0/block/sda/queue/read_ahead_kb u:object_r:vendor_sysfs_scsi_host:s0 -# LiveDisplay -/(vendor|system/vendor)/bin/hw/vendor\.lineage\.livedisplay@2\.1-service\.motorola_holi u:object_r:hal_lineage_livedisplay_qti_exec:s0 - # Motobox /(vendor|system/vendor)/bin/motobox u:object_r:vendor_motobox_exec:s0 diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts index 513b6ea..eba5b72 100644 --- a/sepolicy/vendor/genfs_contexts +++ b/sepolicy/vendor/genfs_contexts @@ -20,10 +20,6 @@ genfscon sysfs /devices/virtual/input # Lights 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_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 - # Motorola genfscon proc /bootinfo u:object_r:proc_moto_boot:s0 genfscon proc /config u:object_r:vendor_proc_hw:s0 diff --git a/sepolicy/vendor/hal_lineage_livedisplay_qti.te b/sepolicy/vendor/hal_lineage_livedisplay_qti.te deleted file mode 100644 index afbf316..0000000 --- a/sepolicy/vendor/hal_lineage_livedisplay_qti.te +++ /dev/null @@ -1 +0,0 @@ -allow hal_lineage_livedisplay_qti sysfs_livedisplay_tuneable:file rw_file_perms; \ No newline at end of file