-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "raphael: Remove livedisplay"
This reverts commit cd185ec.
- Loading branch information
1 parent
37bb535
commit ac79613
Showing
12 changed files
with
337 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -325,6 +325,10 @@ PRODUCT_PROPERTY_OVERRIDES += \ | |
PRODUCT_PACKAGES += \ | ||
android.hardware.light-service.xiaomi | ||
|
||
# Livedisplay | ||
PRODUCT_PACKAGES += \ | ||
[email protected] | ||
|
||
# Media | ||
PRODUCT_PACKAGES += \ | ||
libavservices_minijail \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// 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_binary { | ||
name: "[email protected]", | ||
defaults: ["hidl_defaults"], | ||
vintf_fragments: ["[email protected]"], | ||
init_rc: ["[email protected]"], | ||
relative_install_path: "hw", | ||
srcs: [ | ||
":[email protected]", | ||
"AntiFlicker.cpp", | ||
"SunlightEnhancement.cpp", | ||
"service.cpp", | ||
], | ||
vendor: true, | ||
shared_libs: [ | ||
"libbase", | ||
"libbinder", | ||
"libhidlbase", | ||
"libutils", | ||
"[email protected]", | ||
"[email protected]", | ||
], | ||
header_libs: [ | ||
"[email protected]", | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright (C) 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 "AntiFlickerService" | ||
|
||
#include "AntiFlicker.h" | ||
#include <android-base/logging.h> | ||
#include <fstream> | ||
|
||
namespace vendor { | ||
namespace lineage { | ||
namespace livedisplay { | ||
namespace V2_1 { | ||
namespace implementation { | ||
|
||
static constexpr const char* kDcDimmingPath = | ||
"/sys/devices/platform/soc/soc:qcom,dsi-display-primary/dc_dim"; | ||
|
||
Return<bool> AntiFlicker::isEnabled() { | ||
std::ifstream file(kDcDimmingPath); | ||
int result = -1; | ||
file >> result; | ||
LOG(DEBUG) << "Got result " << result << " fail " << file.fail(); | ||
return !file.fail() && result > 0; | ||
} | ||
|
||
Return<bool> AntiFlicker::setEnabled(bool enabled) { | ||
std::ofstream file(kDcDimmingPath); | ||
file << (enabled ? "1" : "0"); | ||
LOG(DEBUG) << "setEnabled fail " << file.fail(); | ||
return !file.fail(); | ||
} | ||
|
||
} // namespace implementation | ||
} // namespace V2_1 | ||
} // namespace livedisplay | ||
} // namespace lineage | ||
} // namespace vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (C) 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. | ||
*/ | ||
|
||
#ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_1_ANTIFLICKER_H | ||
#define VENDOR_LINEAGE_LIVEDISPLAY_V2_1_ANTIFLICKER_H | ||
|
||
#include <hidl/MQDescriptor.h> | ||
#include <hidl/Status.h> | ||
#include <vendor/lineage/livedisplay/2.1/IAntiFlicker.h> | ||
|
||
namespace vendor { | ||
namespace lineage { | ||
namespace livedisplay { | ||
namespace V2_1 { | ||
namespace implementation { | ||
|
||
using ::android::hardware::Return; | ||
using ::android::hardware::Void; | ||
using ::android::sp; | ||
|
||
class AntiFlicker : public IAntiFlicker { | ||
public: | ||
// Methods from ::vendor::lineage::livedisplay::V2_1::IAntiFlicker follow. | ||
Return<bool> isEnabled() override; | ||
Return<bool> setEnabled(bool enabled) override; | ||
}; | ||
|
||
} // namespace implementation | ||
} // namespace V2_1 | ||
} // namespace livedisplay | ||
} // namespace lineage | ||
} // namespace vendor | ||
|
||
#endif // VENDOR_LINEAGE_LIVEDISPLAY_V2_1_ANTIFLICKER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* 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 "SunlightEnhancementService" | ||
|
||
#include <android-base/file.h> | ||
#include <android-base/logging.h> | ||
#include <android-base/strings.h> | ||
|
||
#include "SunlightEnhancement.h" | ||
|
||
namespace vendor { | ||
namespace lineage { | ||
namespace livedisplay { | ||
namespace V2_1 { | ||
namespace implementation { | ||
|
||
static constexpr const char* kHbmStatusPath = | ||
"/sys/devices/platform/soc/soc:qcom,dsi-display-primary/hbm"; | ||
|
||
Return<bool> SunlightEnhancement::isEnabled() { | ||
std::string buf; | ||
if (!android::base::ReadFileToString(kHbmStatusPath, &buf)) { | ||
LOG(ERROR) << "Failed to read " << kHbmStatusPath; | ||
return false; | ||
} | ||
return std::stoi(android::base::Trim(buf)) == 1; | ||
} | ||
|
||
Return<bool> SunlightEnhancement::setEnabled(bool enabled) { | ||
if (!android::base::WriteStringToFile((enabled ? "1" : "0"), kHbmStatusPath)) { | ||
LOG(ERROR) << "Failed to write " << kHbmStatusPath; | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
} // namespace implementation | ||
} // namespace V2_1 | ||
} // namespace livedisplay | ||
} // namespace lineage | ||
} // namespace vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
#ifndef VENDOR_LINEAGE_LIVEDISPLAY_V2_1_SUNLIGHTENHANCEMENT_H | ||
#define VENDOR_LINEAGE_LIVEDISPLAY_V2_1_SUNLIGHTENHANCEMENT_H | ||
|
||
#include <hidl/MQDescriptor.h> | ||
#include <hidl/Status.h> | ||
#include <vendor/lineage/livedisplay/2.1/ISunlightEnhancement.h> | ||
|
||
namespace vendor { | ||
namespace lineage { | ||
namespace livedisplay { | ||
namespace V2_1 { | ||
namespace implementation { | ||
|
||
using ::android::sp; | ||
using ::android::hardware::Return; | ||
using ::android::hardware::Void; | ||
|
||
class SunlightEnhancement : public ISunlightEnhancement { | ||
public: | ||
// Methods from ::vendor::lineage::livedisplay::V2_1::ISunlightEnhancement follow. | ||
Return<bool> isEnabled() override; | ||
Return<bool> setEnabled(bool enabled) override; | ||
}; | ||
|
||
} // namespace implementation | ||
} // namespace V2_1 | ||
} // namespace livedisplay | ||
} // namespace lineage | ||
} // namespace vendor | ||
|
||
#endif // VENDOR_LINEAGE_LIVEDISPLAY_V2_1_SUNLIGHTENHANCEMENT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* 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 "[email protected]" | ||
|
||
#include <android-base/logging.h> | ||
#include <binder/ProcessState.h> | ||
#include <hidl/HidlTransportSupport.h> | ||
|
||
#include "AntiFlicker.h" | ||
#include "SunlightEnhancement.h" | ||
#include "livedisplay/sdm/SDMController.h" | ||
|
||
using android::OK; | ||
using android::sp; | ||
using android::status_t; | ||
|
||
using ::vendor::lineage::livedisplay::V2_0::sdm::SDMController; | ||
using ::vendor::lineage::livedisplay::V2_1::IAntiFlicker; | ||
using ::vendor::lineage::livedisplay::V2_1::ISunlightEnhancement; | ||
using ::vendor::lineage::livedisplay::V2_1::implementation::AntiFlicker; | ||
using ::vendor::lineage::livedisplay::V2_1::implementation::SunlightEnhancement; | ||
|
||
int main() { | ||
status_t status = OK; | ||
std::shared_ptr<SDMController> controller = std::make_shared<SDMController>(); | ||
sp<AntiFlicker> af = new AntiFlicker(); | ||
sp<SunlightEnhancement> se = new SunlightEnhancement(); | ||
android::hardware::configureRpcThreadpool(1, true /*callerWillJoin*/); | ||
|
||
// AntiFlicker service | ||
status = af->registerAsService(); | ||
if (status != OK) { | ||
LOG(ERROR) << "Could not register service for LiveDisplay HAL AntiFlicker Iface (" | ||
<< status << ")"; | ||
return 1; | ||
} | ||
|
||
// SunlightEnhancement service | ||
status = se->registerAsService(); | ||
if (status != OK) { | ||
LOG(ERROR) << "Could not register service for LiveDisplay HAL SunlightEnhancement Iface (" | ||
<< status << ")"; | ||
return 1; | ||
} | ||
|
||
LOG(INFO) << "LiveDisplay HAL service is ready."; | ||
|
||
android::hardware::joinRpcThreadpool(); | ||
|
||
LOG(ERROR) << "LiveDisplay HAL service failed to join thread pool."; | ||
return 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
on boot | ||
chown system system /sys/devices/platform/soc/soc:qcom,dsi-display-primary/hbm | ||
chown system system /sys/devices/platform/soc/soc:qcom,dsi-display-primary/dc_dim | ||
chmod 0660 /sys/devices/platform/soc/soc:qcom,dsi-display-primary/hbm | ||
chmod 0660 /sys/devices/platform/soc/soc:qcom,dsi-display-primary/dc_dim | ||
|
||
service vendor.livedisplay-hal-2-1 /vendor/bin/hw/[email protected] | ||
class hal | ||
user system | ||
group system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<manifest version="1.0" type="device"> | ||
<hal format="hidl"> | ||
<name>vendor.lineage.livedisplay</name> | ||
<transport>hwbinder</transport> | ||
<fqname>@2.1::IAntiFlicker/default</fqname> | ||
<fqname>@2.1::ISunlightEnhancement/default</fqname> | ||
</hal> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
allow hal_lineage_livedisplay_qti vendor_sysfs_hbm:file rw_file_perms; | ||
allow hal_lineage_livedisplay_qti vendor_sysfs_graphics:dir r_dir_perms; | ||
allow hal_lineage_livedisplay_qti vendor_sysfs_graphics:file rw_file_perms; |