android_device_tecno_LG8n/power/power-mode.cpp
Shirayuki39 b3e2fcb171 LG8n: Hardcode the TAP_TO_WAKE_NODE into the libperfmgr extension
Signed-off-by: Shirayuki39 <lorddemecrius83@proton.me>
2024-08-14 23:56:52 +08:00

50 lines
1.1 KiB
C++

/*
* Copyright (C) 2021 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <aidl/android/hardware/power/BnPower.h>
#include <android-base/file.h>
#include <android-base/logging.h>
#include <sys/ioctl.h>
namespace aidl {
namespace google {
namespace hardware {
namespace power {
namespace impl {
namespace pixel {
using ::aidl::android::hardware::power::Mode;
const std::string TAP_TO_WAKE_NODE = "/proc/gesture_function";
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 pixel
} // namespace impl
} // namespace power
} // namespace hardware
} // namespace google
} // namespace aidl