From ada38b5fed1878164d43d1f2aba84885248ae07a Mon Sep 17 00:00:00 2001 From: Daniel Jacob Chittoor Date: Sat, 18 Sep 2021 04:21:17 +0200 Subject: [PATCH] hidl: Import LiveDisplay 2.0 HIDL HAL w/ IPictureAdjustment Signed-off-by: Daniel Jacob Chittoor Change-Id: I5065670e7dbf9baa4a69d6ec0f5e4c36d533054d --- hidl/livedisplay/Android.bp | 37 +++++++++++ hidl/livedisplay/service.cpp | 61 +++++++++++++++++++ ...r.lineage.livedisplay@2.0-service.oplus.rc | 4 ++ ....lineage.livedisplay@2.0-service.oplus.xml | 7 +++ 4 files changed, 109 insertions(+) create mode 100644 hidl/livedisplay/Android.bp create mode 100644 hidl/livedisplay/service.cpp create mode 100644 hidl/livedisplay/vendor.lineage.livedisplay@2.0-service.oplus.rc create mode 100644 hidl/livedisplay/vendor.lineage.livedisplay@2.0-service.oplus.xml diff --git a/hidl/livedisplay/Android.bp b/hidl/livedisplay/Android.bp new file mode 100644 index 0000000..a555c11 --- /dev/null +++ b/hidl/livedisplay/Android.bp @@ -0,0 +1,37 @@ +// Copyright (C) 2019-2021 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_binary { + name: "vendor.lineage.livedisplay@2.0-service.oplus", + defaults: ["hidl_defaults"], + init_rc: ["vendor.lineage.livedisplay@2.0-service.oplus.rc"], + vintf_fragments: ["vendor.lineage.livedisplay@2.0-service.oplus.xml"], + relative_install_path: "hw", + srcs: [ + ":vendor.lineage.livedisplay@2.0-sdm-pa", + ":vendor.lineage.livedisplay@2.0-sdm-utils", + "service.cpp", + ], + shared_libs: [ + "libbase", + "libbinder", + "libhidlbase", + "libutils", + "vendor.lineage.livedisplay@2.0", + ], + header_libs: [ + "vendor.lineage.livedisplay@2.0-sdm-headers", + ], + proprietary: true, +} diff --git a/hidl/livedisplay/service.cpp b/hidl/livedisplay/service.cpp new file mode 100644 index 0000000..c2358a6 --- /dev/null +++ b/hidl/livedisplay/service.cpp @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2019-2021 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.0-service-oplus" + +#include +#include +#include +#include + +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; + +int main() { + status_t status = OK; + + android::ProcessState::initWithDriver("/dev/vndbinder"); + + LOG(INFO) << "LiveDisplay HAL service is starting."; + + std::shared_ptr controller = std::make_shared(); + + sp pa = new PictureAdjustment(controller); + + configureRpcThreadpool(1, true /*callerWillJoin*/); + + status = pa->registerAsService(); + if (status != OK) { + LOG(ERROR) << "Could not register service for LiveDisplay HAL PictureAdjustment 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; +} diff --git a/hidl/livedisplay/vendor.lineage.livedisplay@2.0-service.oplus.rc b/hidl/livedisplay/vendor.lineage.livedisplay@2.0-service.oplus.rc new file mode 100644 index 0000000..1911235 --- /dev/null +++ b/hidl/livedisplay/vendor.lineage.livedisplay@2.0-service.oplus.rc @@ -0,0 +1,4 @@ +service vendor.livedisplay-hal-2-0 /vendor/bin/hw/vendor.lineage.livedisplay@2.0-service.oplus + class hal + user system + group system diff --git a/hidl/livedisplay/vendor.lineage.livedisplay@2.0-service.oplus.xml b/hidl/livedisplay/vendor.lineage.livedisplay@2.0-service.oplus.xml new file mode 100644 index 0000000..f4f389a --- /dev/null +++ b/hidl/livedisplay/vendor.lineage.livedisplay@2.0-service.oplus.xml @@ -0,0 +1,7 @@ + + + vendor.lineage.livedisplay + hwbinder + 2.0 + +