diff --git a/power-libperfmgr/aidl/Power.cpp b/power-libperfmgr/aidl/Power.cpp index babc0ad..5d2c9f5 100644 --- a/power-libperfmgr/aidl/Power.cpp +++ b/power-libperfmgr/aidl/Power.cpp @@ -76,6 +76,32 @@ Power::Power(std::shared_ptr dlpw, std::shared_ptr } } +static int sysfs_write(const char *path, const char *s) +{ + char buf[80]; + int len; + int ret = 0; + int fd = open(path, O_WRONLY); + + if (fd < 0) { + strerror_r(errno, buf, sizeof(buf)); + ALOGE("Error opening %s: %s\n", path, buf); + return -1 ; + } + + len = write(fd, s, strlen(s)); + if (len < 0) { + strerror_r(errno, buf, sizeof(buf)); + ALOGE("Error writing to %s: %s\n", path, buf); + + ret = -1; + } + + close(fd); + + return ret; +} + ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) { LOG(DEBUG) << "Power setMode: " << toString(type) << " to: " << enabled; if (HintManager::GetInstance()->GetAdpfProfile() && @@ -97,7 +123,10 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) { } [[fallthrough]]; case Mode::DOUBLE_TAP_TO_WAKE: - [[fallthrough]]; + { + sysfs_write("/sys/class/touch/tp_dev/gesture_on", enabled ? "1" : "0"); + } + break; case Mode::FIXED_PERFORMANCE: [[fallthrough]]; case Mode::EXPENSIVE_RENDERING: