sm6375-common: power-libperfmgr: Add support for tap-to-wake feature control
Change-Id: Ib6e1e010834b1b16668d52db79b26804fe0e1671
This commit is contained in:
parent
5e8377d9b9
commit
384c894a8a
1 changed files with 14 additions and 0 deletions
|
@ -30,6 +30,8 @@
|
||||||
#include <utils/Log.h>
|
#include <utils/Log.h>
|
||||||
#include <utils/Trace.h>
|
#include <utils/Trace.h>
|
||||||
|
|
||||||
|
#define TAP_TO_WAKE_NODE "/sys/class/sensors/dt-gesture/enable"
|
||||||
|
|
||||||
namespace aidl {
|
namespace aidl {
|
||||||
namespace google {
|
namespace google {
|
||||||
namespace hardware {
|
namespace hardware {
|
||||||
|
@ -77,6 +79,11 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
|
||||||
LOG(DEBUG) << "Power setMode: " << toString(type) << " to: " << enabled;
|
LOG(DEBUG) << "Power setMode: " << toString(type) << " to: " << enabled;
|
||||||
ATRACE_INT(toString(type).c_str(), enabled);
|
ATRACE_INT(toString(type).c_str(), enabled);
|
||||||
switch (type) {
|
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:
|
case Mode::SUSTAINED_PERFORMANCE:
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
mHintManager->DoHint("SUSTAINED_PERFORMANCE");
|
mHintManager->DoHint("SUSTAINED_PERFORMANCE");
|
||||||
|
@ -88,8 +95,10 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
|
#ifndef TAP_TO_WAKE_NODE
|
||||||
case Mode::DOUBLE_TAP_TO_WAKE:
|
case Mode::DOUBLE_TAP_TO_WAKE:
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
|
#endif
|
||||||
case Mode::FIXED_PERFORMANCE:
|
case Mode::FIXED_PERFORMANCE:
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case Mode::EXPENSIVE_RENDERING:
|
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) {
|
ndk::ScopedAStatus Power::isModeSupported(Mode type, bool *_aidl_return) {
|
||||||
bool supported = mHintManager->IsHintSupported(toString(type));
|
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;
|
LOG(INFO) << "Power mode " << toString(type) << " isModeSupported: " << supported;
|
||||||
*_aidl_return = supported;
|
*_aidl_return = supported;
|
||||||
return ndk::ScopedAStatus::ok();
|
return ndk::ScopedAStatus::ok();
|
||||||
|
|
Loading…
Reference in a new issue