diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk index fca0c78..b8a74c9 100755 --- a/BoardConfigCommon.mk +++ b/BoardConfigCommon.mk @@ -157,7 +157,6 @@ TARGET_PROVIDES_KEYMASTER := true # Power TARGET_USES_INTERACTION_BOOST := true -TARGET_POWERHAL_SET_INTERACTIVE_EXT := $(COMMON_PATH)/power_ext/power_ext.c # Properties TARGET_SYSTEM_PROP += $(COMMON_PATH)/system.prop diff --git a/power/Android.bp b/power/Android.bp index 1de9635..3714007 100644 --- a/power/Android.bp +++ b/power/Android.bp @@ -24,6 +24,7 @@ cc_binary { srcs: [ "service.cpp", "Power.cpp", + "power-ext.c", "power-helper.c", "metadata-parser.c", "utils.c", diff --git a/power_ext/power_ext.c b/power/power-ext.c similarity index 74% rename from power_ext/power_ext.c rename to power/power-ext.c index 1ddd83d..1403c2f 100644 --- a/power_ext/power_ext.c +++ b/power/power-ext.c @@ -21,31 +21,13 @@ #define LOG_TAG "PowerHAL_TR_Ext" #include +#include "utils.h" + #define TOUCHKEY_POWER "/sys/class/input/input6/enabled" #define SPEN_POWER "/sys/class/input/input3/enabled" #define TSP_POWER "/sys/class/input/input2/enabled" #define LCD_POWER "/sys/class/power_supply/battery/lcd" -static void sysfs_write(char *path, char *s) { - char buf[80]; - int len; - int fd = open(path, O_WRONLY); - - if (fd < 0) { - strerror_r(errno, buf, sizeof(buf)); - ALOGE("Error opening %s: %s\n", path, buf); - return; - } - - len = write(fd, s, strlen(s)); - if (len < 0) { - strerror_r(errno, buf, sizeof(buf)); - ALOGE("Error writing to %s: %s\n", path, buf); - } - - close(fd); -} - void power_set_interactive_ext(int on) { ALOGD("%s: %s input devices", __func__, on ? "enabling" : "disabling"); sysfs_write(TSP_POWER, on ? "1" : "0"); diff --git a/power/power-helper.c b/power/power-helper.c index 7b625b6..c52b771 100644 --- a/power/power-helper.c +++ b/power/power-helper.c @@ -350,6 +350,9 @@ void power_set_interactive(int on) struct video_encode_metadata_t video_encode_metadata; int rc = 0; + /* Invoke the extension */ + power_set_interactive_ext(on); + if (set_interactive_override(on) == HINT_HANDLED) { return; } diff --git a/power/power-helper.h b/power/power-helper.h index 77947d4..81e7822 100644 --- a/power/power-helper.h +++ b/power/power-helper.h @@ -81,6 +81,9 @@ void power_hint(power_hint_t hint, void *data); void power_set_interactive(int on); int extract_platform_stats(uint64_t *list); +// Get an extension function +extern void power_set_interactive_ext(int on); + #ifdef __cplusplus } #endif