power: Add support for tap-to-wake feature control
Change-Id: I545902b29f4828c127bc32def6e30b67ce4a3aa7
diff --git a/Android.mk b/Android.mk
index 8086fab..a633927 100644
--- a/Android.mk
+++ b/Android.mk
@@ -72,6 +72,10 @@
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 11e0c21..ebdc60a 100644
--- a/Power.cpp
+++ b/Power.cpp
@@ -29,6 +29,7 @@
#define LOG_TAG "QTI PowerHAL"
+#include <android-base/file.h>
#include <log/log.h>
#include "Power.h"
#include "power-common.h"
@@ -64,6 +65,15 @@
}
Return<void> Power::setFeature(Feature feature, bool activate) {
+ switch (feature) {
+#ifdef TAP_TO_WAKE_NODE
+ case Feature::POWER_FEATURE_DOUBLE_TAP_TO_WAKE:
+ ::android::base::WriteStringToFile(activate ? "1" : "0", TAP_TO_WAKE_NODE);
+ break;
+#endif
+ default:
+ break;
+ }
return Void();
}