Fix for LED light not getting enabled in power off charge mode [2/3]

Issue: FP2P-224
Change-Id: I4b42acba3d11d344ab33527c8613149de03aad89
diff --git a/healthd/healthd_mode_charger.cpp b/healthd/healthd_mode_charger.cpp
index 56a9f86..16b65a7 100644
--- a/healthd/healthd_mode_charger.cpp
+++ b/healthd/healthd_mode_charger.cpp
@@ -41,7 +41,7 @@
 #include <cutils/properties.h>
 #include <cutils/uevent.h>
 #include <sys/reboot.h>
-
+#include <cutils/android_reboot.h>
 #ifdef CHARGER_ENABLE_SUSPEND
 #include <suspend/autosuspend.h>
 #endif
@@ -475,6 +475,8 @@
 static void handle_power_supply_state(charger* charger, int64_t now) {
     if (!charger->have_battery_state) return;
 
+    healthd_board_mode_charger_battery_update(batt_prop);
+
     if (!charger->charger_connected) {
         /* Last cycle would have stopped at the extreme top of battery-icon
          * Need to show the correct level corresponding to capacity.
@@ -624,6 +626,11 @@
 
     LOGW("--------------- STARTING CHARGER MODE ---------------\n");
 
+    if(!healthd_board_mode_charger_init()) {
+        LOGE("healthd_mode_charger_init failed restarting\n");
+        android_reboot(ANDROID_RB_RESTART2, 0, 0);
+    }
+
     ret = ev_init(std::bind(&input_callback, charger, std::placeholders::_1, std::placeholders::_2));
     if (!ret) {
         epollfd = ev_get_epollfd();
diff --git a/healthd/include/healthd/healthd.h b/healthd/include/healthd/healthd.h
index c01e8d7..78cf792 100644
--- a/healthd/include/healthd/healthd.h
+++ b/healthd/include/healthd/healthd.h
@@ -124,4 +124,12 @@
 
 int healthd_board_battery_update(struct android::BatteryProperties *props);
 
+
+//This API is called to update the battery/charging status by using the user
+//noticeable method other then the animation, such as: LEDs
+void healthd_board_mode_charger_battery_update(struct android::BatteryProperties *batt_prop);
+
+//This API is used to handle some board specific charger mode initialization,
+//such as: checking the charging is enabled or not.
+int healthd_board_mode_charger_init(void);
 #endif /* _HEALTHD_H_ */