From 6b46a293dfca52b2dda6237f986c2471cb24147e Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Mon, 19 Oct 2015 14:43:39 -0700 Subject: [PATCH] power: Add support for tap-to-wake feature control Co-authored-by: Arian Co-authored-by: LuK1337 Change-Id: I545902b29f4828c127bc32def6e30b67ce4a3aa7 --- Android.mk | 4 ++++ Power.cpp | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Android.mk b/Android.mk index a61b8fa..7445d14 100644 --- a/Android.mk +++ b/Android.mk @@ -77,6 +77,10 @@ ifeq ($(call is-board-platform-in-list,msmnile), true) LOCAL_SRC_FILES += power-msmnile.c endif +ifneq ($(TARGET_TAP_TO_WAKE_NODE),) + LOCAL_CFLAGS += -DTAP_TO_WAKE_NODE=\"$(TARGET_TAP_TO_WAKE_NODE)\" +endif + ifeq ($(TARGET_USES_INTERACTION_BOOST),true) LOCAL_CFLAGS += -DINTERACTION_BOOST endif diff --git a/Power.cpp b/Power.cpp index 617e265..ec7fec0 100644 --- a/Power.cpp +++ b/Power.cpp @@ -36,6 +36,7 @@ #include "Power.h" #include "PowerHintSession.h" +#include #include #include @@ -65,7 +66,13 @@ void setInteractive(bool interactive) { ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) { LOG(INFO) << "Power setMode: " << static_cast(type) << " to: " << 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; +#else + case Mode::DOUBLE_TAP_TO_WAKE: +#endif case Mode::LOW_POWER: case Mode::LAUNCH: case Mode::DEVICE_IDLE: @@ -98,7 +105,6 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) { ndk::ScopedAStatus Power::isModeSupported(Mode type, bool* _aidl_return) { LOG(INFO) << "Power isModeSupported: " << static_cast(type); - switch(type){ case Mode::EXPENSIVE_RENDERING: if (is_expensive_rendering_supported()) { @@ -107,6 +113,9 @@ ndk::ScopedAStatus Power::isModeSupported(Mode type, bool* _aidl_return) { *_aidl_return = false; } break; +#ifdef TAP_TO_WAKE_NODE + case Mode::DOUBLE_TAP_TO_WAKE: +#endif case Mode::INTERACTIVE: case Mode::SUSTAINED_PERFORMANCE: case Mode::FIXED_PERFORMANCE: