From 132d54c4d15a030f768862d9dfd5c62af171f626 Mon Sep 17 00:00:00 2001 From: Shirayuki39 Date: Wed, 14 Aug 2024 21:10:56 +0800 Subject: [PATCH] LG8n: power: Bring back power-mode.cpp Signed-off-by: Shirayuki39 --- power/power-mode.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 power/power-mode.cpp diff --git a/power/power-mode.cpp b/power/power-mode.cpp new file mode 100644 index 0000000..cad725e --- /dev/null +++ b/power/power-mode.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2021 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace power { +namespace impl { +namespace mediatek { + +using ::aidl::android::hardware::power::Mode; + +bool isDeviceSpecificModeSupported(Mode type, bool* _aidl_return) { + switch (type) { + case Mode::DOUBLE_TAP_TO_WAKE: + *_aidl_return = true; + return true; + default: + return false; + } +} + +bool setDeviceSpecificMode(Mode type, bool enabled) { + switch (type) { + case Mode::DOUBLE_TAP_TO_WAKE: { + ::android::base::WriteStringToFile(enabled ? "cc1" : "cc2", TAP_TO_WAKE_NODE, true); + return true; + } + default: + return false; + } +} + +} // namespace mediatek +} // namespace impl +} // namespace power +} // namespace hardware +} // namespace android +} // namespace aidl