summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--healthd/Android.mk4
-rw-r--r--healthd/healthd_mode_charger.cpp8
2 files changed, 12 insertions, 0 deletions
diff --git a/healthd/Android.mk b/healthd/Android.mk
index 5345338..7db4ad5 100644
--- a/healthd/Android.mk
+++ b/healthd/Android.mk
@@ -51,6 +51,10 @@ ifeq ($(strip $(BOARD_CHARGER_ENABLE_SUSPEND)),true)
LOCAL_CFLAGS += -DCHARGER_ENABLE_SUSPEND
endif
+ifeq ($(strip $(BOARD_NO_CHARGER_LED)),true)
+LOCAL_CFLAGS += -DNO_CHARGER_LED
+endif
+
LOCAL_C_INCLUDES := bootable/recovery
LOCAL_STATIC_LIBRARIES := libbatteryservice libbinder libminui libpng libz libutils libstdc++ libcutils liblog libm libc
diff --git a/healthd/healthd_mode_charger.cpp b/healthd/healthd_mode_charger.cpp
index eb93d6a..5dd666d 100644
--- a/healthd/healthd_mode_charger.cpp
+++ b/healthd/healthd_mode_charger.cpp
@@ -183,6 +183,7 @@ enum {
BLUE_LED = 0x01 << 2,
};
+#ifdef NO_CHARGER_LED
struct led_ctl {
int color;
const char *path;
@@ -203,6 +204,7 @@ struct soc_led_color_mapping soc_leds[3] = {
{90, RED_LED | GREEN_LED},
{100, GREEN_LED},
};
+#endif
static struct charger charger_state;
static struct healthd_config *healthd_config;
@@ -211,6 +213,7 @@ static int char_width;
static int char_height;
static bool minui_inited;
+#ifdef NO_CHARGER_LED
static int set_tricolor_led(int on, int color)
{
int fd, i;
@@ -257,6 +260,7 @@ static int set_battery_soc_leds(int soc)
return 0;
}
+#endif
/* current time in milliseconds */
static int64_t curr_time_ms(void)
@@ -667,14 +671,17 @@ static void handle_input_state(struct charger *charger, int64_t now)
static void handle_power_supply_state(struct charger *charger, int64_t now)
{
+#ifndef NO_CHARGER_LED
static int old_soc = 0;
int soc = 0;
+#endif
if (!charger->have_battery_state)
return;
healthd_board_mode_charger_battery_update(batt_prop);
+#ifndef NO_CHARGER_LED
if (batt_prop && batt_prop->batteryLevel >= 0) {
soc = batt_prop->batteryLevel;
}
@@ -683,6 +690,7 @@ static void handle_power_supply_state(struct charger *charger, int64_t now)
old_soc = soc;
set_battery_soc_leds(soc);
}
+#endif
if (!charger->charger_connected) {