Binder currently may service an incoming oneway transaction whenever
an outbound oneway call is made (if there is already a pending
incoming oneway call waiting). The unexpected nested method call
blocks forever on a recursive mutex acquire because healthd is single-
threaded. The binder behavior is considered a bug and may change in
the future. For now, work around this in healthd.
Make a local copy of the listeners list, then drop the lock and
perform the outbound calls on the local copy of the list.
Bug: 38201220
Test: Marlin with modified client calling scheduleUpdate() repeatedly
Change-Id: If35c2847556245921e2aff808ff747bb60356811
Binder currently may service an incoming oneway transaction whenever
an outbound oneway call is made (if there is already a pending
incoming oneway call waiting). The unexpected nested method call
blocks forever on a recursive mutex acquire because healthd is single-
threaded. The binder behavior is considered a bug and may change in
the future. For now, work around this in healthd.
Make a local copy of the listeners list, then drop the lock and
perform the outbound calls on the local copy of the list.
Bug: 38201220
Test: Marlin with modified client calling scheduleUpdate() repeatedly
Change-Id: If35c2847556245921e2aff808ff747bb60356811
scheduleUpdate forces a healthd battery update,
which will notify all listeners.
Test: Manual (strace -p $healthd_pid)
Bug: 32645990
Change-Id: I8b19f79b633ca8988f0e3dd5be14757f6421ddcb
This method is still used by prebuilts, but making it private to start
the process of removing it from everywhere.
Test: pass
Bug: 35363681
Change-Id: I4d53f68d10c9abcca32023c4d930e99912afa697
The getService() and registerAsService() methods of interface objects
now have default parameters of "default" for the service name. HALs
will not have to use any service name unless they want to register
more than one service.
Test: builds
Bug: 33844934
Change-Id: I9a1fd3ba598bf058b6212bd416ecdf90ea329539
Preserve last Android reboot reason as recorded by android_reboot()
prior to entering charger mode. For example, a thermal shutdown that
reboots to charger mode leaves that reason in place, for user
notification purposes at next Android startup.
Bug: 30994946
Test: manual
Change-Id: I003f57bfff29a471bb647d2cf6b0986ff428985a
ev_init() and ev_iterate_available_keys() now take std::function
callback functions.
Test: mmma system/core/healthd
Change-Id: I8231b57ba816fcba8f698dd7145724021e235664
In order to automatically use the /sys/class/power_supply/bms/charge_full
path for reading learned capacity of the battery, the BMS power supply
(Battery Management System) needs to be considered a battery.
Test: Manual
Change-Id: I66e5751547c3dbdc8de0bb3893367cc6f2c9d733
Subsequently moves the default board hooks to hardware/interface/health
where the new HAL is defined.
This change removes 'healthd's dependency on libhealthd.<target> static hal.
The dependency has now been *temporarily* moved to the new HAL
implementation in hardware/interfaces/health. 'charger' continues to depend
the static HAL.
Test: Tested healthd with and without a board specific health HAL on
Angler.
Bug: b/32724915
Change-Id: I35b56bacde7ded0517bc960f35538d6ca46e6b06
Signed-off-by: Sandeep Patil <sspatil@google.com>
This splits healthd code into 2 pieces as described below.
charger - statically linked executable in /sbin
- responsible for charger-mode UI
- battery/charger monitoring in recovery/charger-mode.
healthd - dynamically linked (*mostly*) executable in /system/bin
- responsible for battery / charger monitoring in Android
- runs 'batteryproperties' service.
Both currently use libhealthd STATIC HALs. However, this now paves
way for the healthd (android) HAL to be a shared library that can
be trebelized.
text data bss dec hex filename
733356 15312 33864 782532 bf0c4 root/sbin/charger
55943 10392 192 66527 103df system/bin/healthd
789299 25704 34056 849059 cf4a3 (TOTALS)
Test: Tested recovery, charge-only and android boot with new binaries
with and without STATIC HAL.
Change-Id: I80f94948dda44d466f172d234b3fcc9064ef2476
Signed-off-by: Sandeep Patil <sspatil@google.com>
This renames the old '/sbin/healthd' to '/sbin/charger'
which is to be only used in recovery and charger-only mode.
.. and adds a new dynamically linked executable in /system/bin/healthd
to be used as 'healthd' in Android.
text data bss dec hex filename
817404 36704 37960 892068 d9ca4 root/sbin/charger {was healthd}
72717 11064 12984 96765 179fd system/bin/healthd {*new*}
890121 47768 50944 988833 f16a1 (TOTALS)
Corresponding changes in recovery and charger-only .rc files are
required change how 'charger' is launched in each mode.
Update the seclable for healthd with the launch path in init.rc
Test: Boot tested and verified all 3 modes (recovery, charge-only,
android)
Change-Id: I4ada27a4c113258c5be1fd10adb0f58232b10024
Signed-off-by: Sandeep Patil <sspatil@google.com>
The charger code lands in 'libhealthd_charger' and androoid/framework
facing code is now compiled into 'libhealtdh_android' (formerly
libhealthd_internal).
This is a pre-cursor to eventually splitting healthd into 2 binaries,
viz ..
1. /sbin/charger - statically linked binary to be used *only* in recovery
and charge-only mode(s).
2. /system/bin/healthd - dynamically linked binary to be used *only* in
Android.
The static board hal (i.e libhealthd.<target>) will then be compiled
twice for charger and healthd seperately, paving the way for us to
seperate out the HAL for Android
Test: Boot tested and verified 'healthd' works in recovery,
charger-only mode and Android.
Change-Id: If45213ddd14c00ea3b8e1759cfd99286ca1ef2ea
Signed-off-by: Sandeep Patil <sspatil@google.com>
Fixed a bug in makefile that was keeping CHARGER_ENABLE_SUSPEND from
getting properly set, so healthd was not trying to put kernel into
suspend.
Bug: 32162033
Change-Id: If054d7996fa5734285cbcd7d497492570076c141
Devices can now override DEFAULT_PERIODIC_CHORES_INTERVAL_FAST
and DEFAULT_PERIODIC_CHORES_INTERVAL_SLOW by defining a value for
BOARD_PERIODIC_CHORES_INTERVAL_FAST and/or BOARD_PERIODIC_CHORES_INTERVAL_SLOW
in the device's BoardConfig.mk file.
Bug: 32162033
Change-Id: I956fd4760893ae6c2eb3a3af586353d4d66daf25
The binder fd doesn't need to use EPOLLWAKEUP and shouldn't; if it does,
it will prevent suspend unnecessarily.
bug 32180327
Change-Id: I292f1ada0c698290f6bd5518b237867ed69ec391
Allow the charging animation to be customized with a configuration file
and custom assets.
- Add a parser to parse a custom configuration file.
- Add support for showing a clock and the battery percentage.
- Expand feature that conditionally shows animation frames using min_level
and level_only to min_level and max_level
BUG: 29547343
Change-Id: Ia33f4bb37dc7d4c7fa6507a63481e93bf0bf9738
* Use const reference type for parameters to avoid unnecessary copy.
Bug: 30407689
Change-Id: I926ea7b6e9e020a228c812b7e23087a2b7ed9809
Test: build with WITH_TIDY=1
In readFromFile() when a newline is not found in the data, we reset
the initial character of the buffer to \0, but leave the count as is
(something >0 in this case).
Later in getBooleanField() we could erroneously treat a response as
"true" because count would be >0 and the initial value of buf would
be != '0' (set to \0 in this case).
To fixup error paths such as this, we can simplify readFromFile
by using android::base functions: ReadFromFileString() and Trim().
NOTES:
- Converted char * buffers used with readFromFile to std::string
- Removed unused variable btech from BatteryMonitor::update
Testing Done:
- Build healthd and recovery for angler device
- Confirm that known values are being read correctly from kernel
sysfs.
Change-Id: I238bbff097543767f352aa084bf0acbc1324baca
Signed-off-by: Michael Scott <michael.scott@linaro.org>
setting fake properties.
healthd used to check for registered charger drivers to determine if the
device is an always-plugged device with no battery. This patch changes
it to check for battery instead.
Change-Id: Ie4ff5d3f21dc1a83a780a41eb0c929f66b86d631
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
(cherry picked from commit fabd490f58)
When creating static libs with healthd logic, explicitly
reference libbinder to pick up its header include paths.
Bug: 27804373
Test: healthd libs compile when libbinder's header include
paths change.
Change-Id: I1014eb0b73d06815c42a527c4ea7e63c35ca3530
setting fake properties.
healthd used to check for registered charger drivers to determine if the
device is an always-plugged device with no battery. This patch changes
it to check for battery instead.
Change-Id: Ie4ff5d3f21dc1a83a780a41eb0c929f66b86d631
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
With Type-C PD, VBUS can no longer be assumed to
to be at 5V. Read the "voltage_max" field from the
power_supply class node and export it through
BatteryProperties service.
Bug: 25229483
Change-Id: I04e32d9783a21bab375f1724758a9eeace2a047c
recovery needs to know whether the battery is charged.
Bug: 26879394
Change-Id: Ie2a1d06e81878efa3ff432c2015d409a625e473e
(cherry picked from commit aedf6038dc)
Boards can opt to have charger mode be passive, with no screen UI or key
processing, the same as for recovery mode, via BOARD_CHARGER_NO_UI. The
minui and associated libs and charging image files are not built into the
executable in this case.
Always select charger No UI operation for Brillo devices.
Bug: 27170356
Change-Id: Ibe71498743353b01ce5b6521e42ed94d75547547
and print a warning message containing the type
when the battery monitor fails to recognize a power supply.
Change-Id: I02ebd89736f7444f8bf7f28550afeec82d57e107
Call addService using a reference to a strong pointer to the service object,
such that the proper IBinder object is ref counted, instead of passing the
object's this pointer.
Bug: None
Change-Id: I72cac08c835a17b8cc263b2dc34864420b7a2841
Use 1972 as a right delineation. Otherwise use half way point
between the monotonic and realtime. Treat correction factor as
unsigned, ensure that any wrapping to a negative value is
dropped or set to EPOCH. Acknowledge that we can get a more
accurate time track by acquiring the time rather than relying on
healthd timestamp.
Bug: 26331432
Change-Id: I09075fca58676a30cf7d87baf2d4b0f53795abaa
CL in [1] changes the minui API of res_create_multi_display_surface()
(bootable/recovery/minui/minui.h). Track the change accordingly.
[1] commit b723f4f38f53a38502abb1a63165ac0749bc9cd9
Change-Id: If9684019105ff91d5ade5b69e88849af766c2a19
See the new types added here :
https://chromium-review.googlesource.com/304660
Add support for these.
Signed-off-by: Benson Leung <bleung@google.com>
Change-Id: I12c51e0611692a763a7f1cda57c77ad83d7aa7ea
With Type-C PD, VBUS can no longer be assumed to
to be at 5V. Read the "voltage_max" field from the
power_supply class node and export it through
BatteryProperties service.
Bug: 25229483
Change-Id: I04e32d9783a21bab375f1724758a9eeace2a047c
Devices which have no battery and are always plugged in will not have
any battery property initialized. This causes the 'stable power' to
never be switched which is required for updating apps.
This change recognizes such a device and manually sets the battery to
100% and charger status to connected to AC mains. It will also fake the
battery temperature.
Bug: 24258855
Change-Id: I98e5ed0dbeb7f2ab6d3802cd7e0f3a269bd8f31f
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Devices which have no battery and are always plugged in will not have
any battery property initialized. This causes the 'stable power' to
never be switched which is required for updating apps.
This change recognizes such a device and manually sets the battery to
100% and charger status to connected to AC mains. It will also fake the
battery temperature.
Bug: 24258855
Change-Id: I98e5ed0dbeb7f2ab6d3802cd7e0f3a269bd8f31f
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
(cherry pick from commit acb1ddf56c)
Aid monotonic to realtime logging synchronization correction in
the Android ecosystem by providing a periodic notification. We
now have the following messages in the kernel logs:
- PM: suspend entry %Y-%m-%d %H:%M:%S.%09q UTC
- PM: suspend exit %Y-%m-%d %H:%M:%S.%09q UTC
- Suspended for %s.%03q seconds
- healthd: battery l=100 ... %Y-%m-%d %H:%M:%S.%09q UTC
Alter klogd to resynchronize on healthd messages as well.
NB: Time using strftime format, %q is a reference to fractional
second as introduced into log_time strptime method.
Bug: 21868540
Change-Id: I854afc0a07dff9c7f26d2b2f68990e52bf90e300
Aid monotonic to realtime logging synchronization correction in
the Android ecosystem by providing a periodic notification. We
now have the following messages in the kernel logs:
- PM: suspend entry %Y-%m-%d %H:%M:%S.%09q UTC
- PM: suspend exit %Y-%m-%d %H:%M:%S.%09q UTC
- Suspended for %s.%03q seconds
- healthd: battery l=100 ... %Y-%m-%d %H:%M:%S.%09q UTC
Alter klogd to resynchronize on healthd messages as well.
NB: Time using strftime format, %q is a reference to fractional
second as introduced into log_time strptime method.
Bug: 21868540
Change-Id: I854afc0a07dff9c7f26d2b2f68990e52bf90e300
In charger-mode, power off/on screen as required, for efficient
charging.
Turn on screen on power-key press rather than on key-release.
On charge-cable removal, kick animation to show the correct battery
level.
Change-Id: I74eaf8681466c44dbd76a820adf154053e0fc43a
Signed-off-by: Pavan Kumar S <pavan.kumar.s@intel.com>
Signed-off-by: Jenny TC <jenny.tc@intel.com>
Signed-off-by: Yong Yao <yong.yao@intel.com>
Existing code allows charger-mode to exit to Android even with 0%
battery.
This might lead to more battery discharge while booting to Android,
especially if only USB-charger is connected, and thus certain
features/components not functioning as expected in Android.
This patch adds a configurable parameter to improve the user experience
by preventing the charger exit till battery capacity is good enough to
boot Android
Change-Id: I56a283243551373e962ac562f25eaf11f07666c3
Signed-off-by: Pavan Kumar S <pavan.kumar.s@intel.com>
Signed-off-by: Jenny TC <jenny.tc@intel.com>
Signed-off-by: Yong Yao <yong.yao@intel.com>
Adds a callback to the healthdHAL which can check for device specific
properties to decide if the screen should turn on.
Change-Id: I543e7729ecb291157df4d3be1bd718f8af01ac40
Signed-off-by: Ruchi Kandoi<kandoiruchi@google.com>
If charger is connected and battery capacity is 0, charging animation should
run. The device would be booted up even if capacity is 0 in off-mode charging.
At that time, it would take some time to be 1 from 0 for capacity if you
use USB charger.
Bug: 17606689
Change-Id: I37e0f1b6ab0ee1f6d833882e169bf3ea06cf2399
To allow healthd/charger info to appear in systems where the loglevel
has been bumped to squelch chatty drivers.
Change-Id: I4ab135765700d7584a1ce5d972ea473d77f299f8
Logic for this check was inadvertently reversed when porting this from
the charger daemon to healthd. Request suspend if a charegr is connected,
else stay out of suspend waiting for a charger connect or power off if
none.
Bug: 17112463
Change-Id: Iffdb6dbcd0d0a2a614ff8f50bf5f2e22e1ad552f
connected to fake battery.
Detects if the device is attached to a fake battery if yes, healthd
reports 42% battery charge and 42.2 degrees temperature.
Change-Id: I2508fd91c8d3848ea64f57ab59d20be1c2817913
At present, charging animation runs irrespective of whether charger is
connected or not. When the charger is disconnected, device does not
shutdown for 10sec. Charger animation during this period should be
avoided.
Change-Id: I34dc5028522ca199d50a1a1b684b035b2d81ef68
setprop persist.sys.battery.capacity 77
setprop persist.sys.battery.temperature 123
and reboot to cause a fixed battery level of 77% and temperature of 12.3C
to be reported to Android.
Typically used on power evaluation boards without batteries connected.
Bug: 14839868
Change-Id: Ibae5e16429d05891cb0787d74a2fe93b07013699