healthd: charger: Turn off charging animation by power key event

Currently, the charging animation can be turned on by power key event. Add
support to make charging animation can be turned off by power key event.

Change-Id: Icc8101ae3d4fd777efedeff10ca535a9e6e7a57d

Signed-off-by: artas182x <artas182x@gmail.com>
healthd: charger: Draw battery capacity in charging animation

Draw a text to show the battery capacity value in charging animation.

Change-Id: I0117fb0aee69181ce0d608ba4b1644fa42cd1a0d

Signed-off-by: artas182x <artas182x@gmail.com>
healthd: charger: Add backlight control in charging animation

On some targets the FBIOBLANK does not control the backlight. Add the
backlight control in charging animation to make sure the backlight will
be turned on/off successfully.

Change-Id: I3bba3b58daba6cffa4eb1314a6da1542f43e8e47

Signed-off-by: artas182x <artas182x@gmail.com>
charger: check the charging_enabled at the beginning of power off charging

Check charging_enabled flag in power off charging process, reboot the
device if charging is disabled to exit power off charging mode.

Change-Id: I11208acb1dd82a06b42911fdbcc7e58f6f97e96c

Signed-off-by: artas182x <artas182x@gmail.com>
init: Bring back support for arbitrary chargermode cmdlines

This was accidentally removed while debugging the init breakage
fixed in change I8ef5c932efcd5e7f8d6f6fce0915683d84c3ee11. Put
it back

Change-Id: If35b9d5db281f8aab6de26f2bb63717d28b2db30

Signed-off-by: artas182x <artas182x@gmail.com>
init: add detection of charging mode

Based on Prashant Somashekar's patch which is in turn based on techomancer's
patch http://goo.gl/I19GG.

When BOARD_CHARGING_MODE_BOOTING_LPM is set, init will read that
value (usually from /sys) and enable charging mode when set to 1.

This differs from the original patch in that Samsung-specific lpm.rc
is not loaded, but instead, init.rc is loaded using the "charger" class,
which is how AOSP devices handle charging.

The change is because the either the SELinux or the init.rc changes is
causing lpm.rc to not work, and porting lpm.rc to the Android system
is easier than trying to fix it.

Change-Id: Ice7a074da7e982f9a64aaa97de28bfcbccdc8b91

Signed-off-by: artas182x <artas182x@gmail.com>
charger: allow home button to wake

A squashed commit of the following:

commit 6ce21d726a967b2cc942476758b9ab3851ff39f1
Author: Pawit Pornkitprasan <p.pawit@gmail.com>
Date:   Sun Feb 3 22:21:32 2013 +0700

    charger: do not suspend when handling home

    When using Google's suspend implementation, home press should also wake
    the device from suspend

    Change-Id: I51f3e45c5cb418b0b3718e7223a1336876379043

commit 75a7cf84df719d8cf5cd77093b3f9fee3c09017e
Author: Pawit Pornkitprasan <p.pawit@gmail.com>
Date:   Sat Jul 21 22:09:37 2012 +0700

    charger: allow home button to wake

    On certain devices (e.g. galaxysmtd), the user expects the physical
    home button to be able to wake the device as well as the power button.

    Change-Id: If764f36aba3810dfa5233af8baf0a740b04889e0

Change-Id: I362b227e26bc864a2cad471df799bce2d682ecee

Signed-off-by: artas182x <artas182x@gmail.com>
healthd: charger: only reboot under NORMAL mode

If charger is not launched from normal poweroff charging,
we don't want device to reboot. Just leave charger process
to exit by itself but not reboot when not under NORMAL mode.

Change-Id: I9f6535042d7016e21d172d167069a134c8851fa6

Signed-off-by: artas182x <artas182x@gmail.com>
healthd: Support alarm in power off charging mode

To implement this feature need to let the phone reboot some time
earlier than the alarm time.

Change-Id: I6505a99b51932ffa23518769f8fd4d2590021543

Signed-off-by: artas182x <artas182x@gmail.com>