Loading charger/Android.mk +7 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,10 @@ ifeq ($(strip $(BOARD_CHARGER_DISABLE_INIT_BLANK)),true) LOCAL_CFLAGS := -DCHARGER_DISABLE_INIT_BLANK endif ifeq ($(strip $(BOARD_CHARGER_ENABLE_SUSPEND)),true) LOCAL_CFLAGS += -DCHARGER_ENABLE_SUSPEND endif LOCAL_MODULE := charger LOCAL_MODULE_TAGS := optional LOCAL_FORCE_STATIC_EXECUTABLE := true Loading @@ -21,6 +25,9 @@ LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED) LOCAL_C_INCLUDES := bootable/recovery LOCAL_STATIC_LIBRARIES := libminui libpixelflinger_static libpng ifeq ($(strip $(BOARD_CHARGER_ENABLE_SUSPEND)),true) LOCAL_STATIC_LIBRARIES += libsuspend endif LOCAL_STATIC_LIBRARIES += libz libstdc++ libcutils libm libc ifneq ($(BOARD_BATTERY_DEVICE_NAME),) Loading charger/charger.c +25 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,10 @@ #include <cutils/misc.h> #include <cutils/uevent.h> #ifdef CHARGER_ENABLE_SUSPEND #include <suspend/autosuspend.h> #endif #include "minui/minui.h" #ifndef max Loading Loading @@ -382,6 +386,21 @@ static void remove_supply(struct charger *charger, struct power_supply *supply) free(supply); } #ifdef CHARGER_ENABLE_SUSPEND static int request_suspend(bool enable) { if (enable) return autosuspend_enable(); else return autosuspend_disable(); } #else static int request_suspend(bool enable) { return 0; } #endif static void parse_uevent(const char *msg, struct uevent *uevent) { uevent->action = ""; Loading Loading @@ -729,6 +748,8 @@ static void update_screen_state(struct charger *charger, int64_t now) write_file(SYS_POWER_STATE, "mem", strlen("mem")); #endif LOGV("[%lld] animation done\n", now); if (charger->num_supplies_online > 0) request_suspend(true); return; } Loading Loading @@ -868,9 +889,11 @@ static void process_key(struct charger *charger, int code, int64_t now) } } else { /* if the power key got released, force screen state cycle */ if (key->pending) if (key->pending) { request_suspend(false); kick_animation(charger->batt_anim); } } } else { if (key->pending) kick_animation(charger->batt_anim); Loading @@ -891,6 +914,7 @@ static void handle_input_state(struct charger *charger, int64_t now) static void handle_power_supply_state(struct charger *charger, int64_t now) { if (charger->num_supplies_online == 0) { request_suspend(false); if (charger->next_pwr_check == -1) { charger->next_pwr_check = now + UNPLUGGED_SHUTDOWN_TIME; LOGI("[%lld] device unplugged: shutting down in %lld (@ %lld)\n", Loading libsuspend/Android.mk +9 −1 Original line number Diff line number Diff line Loading @@ -12,7 +12,6 @@ libsuspend_libraries := \ liblog libcutils include $(CLEAR_VARS) LOCAL_SRC_FILES := $(libsuspend_src_files) LOCAL_MODULE := libsuspend LOCAL_MODULE_TAGS := optional Loading @@ -21,3 +20,12 @@ LOCAL_C_INCLUDES += $(LOCAL_PATH)/include LOCAL_SHARED_LIBRARIES := $(libsuspend_libraries) #LOCAL_CFLAGS += -DLOG_NDEBUG=0 include $(BUILD_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(libsuspend_src_files) LOCAL_MODULE := libsuspend LOCAL_MODULE_TAGS := optional LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include LOCAL_C_INCLUDES += $(LOCAL_PATH)/include #LOCAL_CFLAGS += -DLOG_NDEBUG=0 include $(BUILD_STATIC_LIBRARY) Loading
charger/Android.mk +7 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,10 @@ ifeq ($(strip $(BOARD_CHARGER_DISABLE_INIT_BLANK)),true) LOCAL_CFLAGS := -DCHARGER_DISABLE_INIT_BLANK endif ifeq ($(strip $(BOARD_CHARGER_ENABLE_SUSPEND)),true) LOCAL_CFLAGS += -DCHARGER_ENABLE_SUSPEND endif LOCAL_MODULE := charger LOCAL_MODULE_TAGS := optional LOCAL_FORCE_STATIC_EXECUTABLE := true Loading @@ -21,6 +25,9 @@ LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED) LOCAL_C_INCLUDES := bootable/recovery LOCAL_STATIC_LIBRARIES := libminui libpixelflinger_static libpng ifeq ($(strip $(BOARD_CHARGER_ENABLE_SUSPEND)),true) LOCAL_STATIC_LIBRARIES += libsuspend endif LOCAL_STATIC_LIBRARIES += libz libstdc++ libcutils libm libc ifneq ($(BOARD_BATTERY_DEVICE_NAME),) Loading
charger/charger.c +25 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,10 @@ #include <cutils/misc.h> #include <cutils/uevent.h> #ifdef CHARGER_ENABLE_SUSPEND #include <suspend/autosuspend.h> #endif #include "minui/minui.h" #ifndef max Loading Loading @@ -382,6 +386,21 @@ static void remove_supply(struct charger *charger, struct power_supply *supply) free(supply); } #ifdef CHARGER_ENABLE_SUSPEND static int request_suspend(bool enable) { if (enable) return autosuspend_enable(); else return autosuspend_disable(); } #else static int request_suspend(bool enable) { return 0; } #endif static void parse_uevent(const char *msg, struct uevent *uevent) { uevent->action = ""; Loading Loading @@ -729,6 +748,8 @@ static void update_screen_state(struct charger *charger, int64_t now) write_file(SYS_POWER_STATE, "mem", strlen("mem")); #endif LOGV("[%lld] animation done\n", now); if (charger->num_supplies_online > 0) request_suspend(true); return; } Loading Loading @@ -868,9 +889,11 @@ static void process_key(struct charger *charger, int code, int64_t now) } } else { /* if the power key got released, force screen state cycle */ if (key->pending) if (key->pending) { request_suspend(false); kick_animation(charger->batt_anim); } } } else { if (key->pending) kick_animation(charger->batt_anim); Loading @@ -891,6 +914,7 @@ static void handle_input_state(struct charger *charger, int64_t now) static void handle_power_supply_state(struct charger *charger, int64_t now) { if (charger->num_supplies_online == 0) { request_suspend(false); if (charger->next_pwr_check == -1) { charger->next_pwr_check = now + UNPLUGGED_SHUTDOWN_TIME; LOGI("[%lld] device unplugged: shutting down in %lld (@ %lld)\n", Loading
libsuspend/Android.mk +9 −1 Original line number Diff line number Diff line Loading @@ -12,7 +12,6 @@ libsuspend_libraries := \ liblog libcutils include $(CLEAR_VARS) LOCAL_SRC_FILES := $(libsuspend_src_files) LOCAL_MODULE := libsuspend LOCAL_MODULE_TAGS := optional Loading @@ -21,3 +20,12 @@ LOCAL_C_INCLUDES += $(LOCAL_PATH)/include LOCAL_SHARED_LIBRARIES := $(libsuspend_libraries) #LOCAL_CFLAGS += -DLOG_NDEBUG=0 include $(BUILD_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_SRC_FILES := $(libsuspend_src_files) LOCAL_MODULE := libsuspend LOCAL_MODULE_TAGS := optional LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include LOCAL_C_INCLUDES += $(LOCAL_PATH)/include #LOCAL_CFLAGS += -DLOG_NDEBUG=0 include $(BUILD_STATIC_LIBRARY)