power: Add support for tap-to-wake feature control

Co-authored-by: Arian <arian.kulmer@web.de>
Co-authored-by: LuK1337 <priv.luk@gmail.com>
Change-Id: I545902b29f4828c127bc32def6e30b67ce4a3aa7
This commit is contained in:
Steve Kondik
2015-10-19 14:43:39 -07:00
committed by Michael Bestas
parent 9df9caa266
commit 6b46a293df
2 changed files with 14 additions and 1 deletions

View File

@@ -77,6 +77,10 @@ ifeq ($(call is-board-platform-in-list,msmnile), true)
LOCAL_SRC_FILES += power-msmnile.c LOCAL_SRC_FILES += power-msmnile.c
endif 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) ifeq ($(TARGET_USES_INTERACTION_BOOST),true)
LOCAL_CFLAGS += -DINTERACTION_BOOST LOCAL_CFLAGS += -DINTERACTION_BOOST
endif endif

View File

@@ -36,6 +36,7 @@
#include "Power.h" #include "Power.h"
#include "PowerHintSession.h" #include "PowerHintSession.h"
#include <android-base/file.h>
#include <android-base/logging.h> #include <android-base/logging.h>
#include <aidl/android/hardware/power/BnPower.h> #include <aidl/android/hardware/power/BnPower.h>
@@ -65,7 +66,13 @@ void setInteractive(bool interactive) {
ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) { ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
LOG(INFO) << "Power setMode: " << static_cast<int32_t>(type) << " to: " << enabled; LOG(INFO) << "Power setMode: " << static_cast<int32_t>(type) << " to: " << enabled;
switch(type){ switch(type){
#ifdef TAP_TO_WAKE_NODE
case Mode::DOUBLE_TAP_TO_WAKE: 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::LOW_POWER:
case Mode::LAUNCH: case Mode::LAUNCH:
case Mode::DEVICE_IDLE: 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) { ndk::ScopedAStatus Power::isModeSupported(Mode type, bool* _aidl_return) {
LOG(INFO) << "Power isModeSupported: " << static_cast<int32_t>(type); LOG(INFO) << "Power isModeSupported: " << static_cast<int32_t>(type);
switch(type){ switch(type){
case Mode::EXPENSIVE_RENDERING: case Mode::EXPENSIVE_RENDERING:
if (is_expensive_rendering_supported()) { if (is_expensive_rendering_supported()) {
@@ -107,6 +113,9 @@ ndk::ScopedAStatus Power::isModeSupported(Mode type, bool* _aidl_return) {
*_aidl_return = false; *_aidl_return = false;
} }
break; break;
#ifdef TAP_TO_WAKE_NODE
case Mode::DOUBLE_TAP_TO_WAKE:
#endif
case Mode::INTERACTIVE: case Mode::INTERACTIVE:
case Mode::SUSTAINED_PERFORMANCE: case Mode::SUSTAINED_PERFORMANCE:
case Mode::FIXED_PERFORMANCE: case Mode::FIXED_PERFORMANCE: