mirror of
https://github.com/Anything-at-25-00/android_device_tecno_LG8n.git
synced 2024-11-22 21:56:26 -08:00
LG8n: power: Bring back power-mode.cpp
Signed-off-by: Shirayuki39 <lorddemecrius83@proton.me>
This commit is contained in:
parent
2dd72e1e4f
commit
132d54c4d1
47
power/power-mode.cpp
Normal file
47
power/power-mode.cpp
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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 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
|
Loading…
Reference in a new issue