diff options
-rw-r--r-- | charger/Android.mk | 7 | ||||
-rw-r--r-- | charger/charger.c | 26 | ||||
-rw-r--r-- | fs_mgr/fs_mgr.c | 4 | ||||
-rw-r--r-- | include/private/android_filesystem_config.h | 2 | ||||
-rw-r--r-- | libsuspend/Android.mk | 10 | ||||
-rw-r--r-- | rootdir/init.rc | 2 | ||||
-rw-r--r-- | rootdir/init.usb.rc | 1 |
7 files changed, 48 insertions, 4 deletions
diff --git a/charger/Android.mk b/charger/Android.mk index fe0c91d..0258604 100644 --- a/charger/Android.mk +++ b/charger/Android.mk @@ -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 @@ -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 include $(BUILD_EXECUTABLE) diff --git a/charger/charger.c b/charger/charger.c index c5e4ec2..353bdf0 100644 --- a/charger/charger.c +++ b/charger/charger.c @@ -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 @@ -352,6 +356,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 = ""; @@ -685,6 +704,8 @@ static void update_screen_state(struct charger *charger, int64_t now) charger->next_screen_transition = -1; gr_fb_blank(true); LOGV("[%lld] animation done\n", now); + if (charger->num_supplies_online > 0) + request_suspend(true); return; } @@ -824,8 +845,10 @@ 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); + } } } @@ -843,6 +866,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", diff --git a/fs_mgr/fs_mgr.c b/fs_mgr/fs_mgr.c index 2bcc9c4..e51c9cf 100644 --- a/fs_mgr/fs_mgr.c +++ b/fs_mgr/fs_mgr.c @@ -523,11 +523,11 @@ int fs_mgr_do_mount(char *fstab_file, char *n_name, char *n_blk_dev, char *tmp_m /* We found our match */ /* First check the filesystem if requested */ if (fstab[i].fs_mgr_flags & MF_WAIT) { - wait_for_file(fstab[i].blk_dev, WAIT_TIMEOUT); + wait_for_file(n_blk_dev, WAIT_TIMEOUT); } if (fstab[i].fs_mgr_flags & MF_CHECK) { - check_fs(fstab[i].blk_dev, fstab[i].type, fstab[i].mnt_point); + check_fs(n_blk_dev, fstab[i].type, fstab[i].mnt_point); } /* Now mount it where requested */ diff --git a/include/private/android_filesystem_config.h b/include/private/android_filesystem_config.h index f90af81..746bec3 100644 --- a/include/private/android_filesystem_config.h +++ b/include/private/android_filesystem_config.h @@ -63,6 +63,7 @@ #define AID_NFC 1027 /* nfc subsystem */ #define AID_SDCARD_R 1028 /* external storage read access */ #define AID_CLAT 1029 /* clat part of nat464 */ +#define AID_LOOP_RADIO 1030 /* loop radio devices */ #define AID_SHELL 2000 /* adb and debug shell user */ #define AID_CACHE 2001 /* cache access */ @@ -138,6 +139,7 @@ static const struct android_id_info android_ids[] = { { "net_admin", AID_NET_ADMIN, }, { "net_bw_stats", AID_NET_BW_STATS, }, { "net_bw_acct", AID_NET_BW_ACCT, }, + { "loop_radio", AID_LOOP_RADIO, }, { "misc", AID_MISC, }, { "nobody", AID_NOBODY, }, { "clat", AID_CLAT, }, diff --git a/libsuspend/Android.mk b/libsuspend/Android.mk index 45cb701..a2fa3e0 100644 --- a/libsuspend/Android.mk +++ b/libsuspend/Android.mk @@ -12,7 +12,6 @@ libsuspend_libraries := \ liblog libcutils include $(CLEAR_VARS) - LOCAL_SRC_FILES := $(libsuspend_src_files) LOCAL_MODULE := libsuspend LOCAL_MODULE_TAGS := optional @@ -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) diff --git a/rootdir/init.rc b/rootdir/init.rc index 5205200..871a1f7 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -300,6 +300,8 @@ on boot chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse chown system system /sys/devices/system/cpu/cpufreq/interactive/input_boost chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/input_boost + chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration + chmod 0660 /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration # Assume SMP uses shared cpufreq policy for all CPUs chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq diff --git a/rootdir/init.usb.rc b/rootdir/init.usb.rc index 15467cc..f37b630 100644 --- a/rootdir/init.usb.rc +++ b/rootdir/init.usb.rc @@ -88,4 +88,5 @@ on property:sys.usb.config=accessory,audio_source,adb # Used to set USB configuration at boot and to switch the configuration # when changing the default configuration on property:persist.sys.usb.config=* + setprop sys.usb.config none setprop sys.usb.config ${persist.sys.usb.config} |