sm6375-common: power-libperfmgr: Add support for tap-to-wake feature control

Change-Id: Ib6e1e010834b1b16668d52db79b26804fe0e1671
This commit is contained in:
Stefanie Kondik 2024-07-18 12:56:42 +05:30 committed by Anand S
parent 5e8377d9b9
commit 384c894a8a
No known key found for this signature in database
GPG key ID: 3B2983FA448B3D61

View file

@ -30,6 +30,8 @@
#include <utils/Log.h>
#include <utils/Trace.h>
#define TAP_TO_WAKE_NODE "/sys/class/sensors/dt-gesture/enable"
namespace aidl {
namespace google {
namespace hardware {
@ -77,6 +79,11 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
LOG(DEBUG) << "Power setMode: " << toString(type) << " to: " << enabled;
ATRACE_INT(toString(type).c_str(), enabled);
switch (type) {
#ifdef TAP_TO_WAKE_NODE
case Mode::DOUBLE_TAP_TO_WAKE:
::android::base::WriteStringToFile(enabled ? "1" : "0", TAP_TO_WAKE_NODE, true);
break;
#endif
case Mode::SUSTAINED_PERFORMANCE:
if (enabled) {
mHintManager->DoHint("SUSTAINED_PERFORMANCE");
@ -88,8 +95,10 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
break;
}
[[fallthrough]];
#ifndef TAP_TO_WAKE_NODE
case Mode::DOUBLE_TAP_TO_WAKE:
[[fallthrough]];
#endif
case Mode::FIXED_PERFORMANCE:
[[fallthrough]];
case Mode::EXPENSIVE_RENDERING:
@ -116,6 +125,11 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
ndk::ScopedAStatus Power::isModeSupported(Mode type, bool *_aidl_return) {
bool supported = mHintManager->IsHintSupported(toString(type));
#ifdef TAP_TO_WAKE_NODE
if (type == Mode::DOUBLE_TAP_TO_WAKE) {
supported = true;
}
#endif
LOG(INFO) << "Power mode " << toString(type) << " isModeSupported: " << supported;
*_aidl_return = supported;
return ndk::ScopedAStatus::ok();