Commit graph

196 commits

Author SHA1 Message Date
Yifan Hong
a922d6b596 healthd: Add elsk as OWNERS
Test: none
Change-Id: I676621ced38308296c32259c9525a8d55948e937
2018-05-03 12:25:00 -07:00
Dan Willemsen
fd72bde475 Remove obsolete BRILLO variable
Test: none
Change-Id: Iaf563b78819d63cb5ab7316a195a860b150d69c6
2018-03-10 15:41:37 -08:00
Yi Kong
808e57e3f3 healthd: Fix negativity check after cast to unsigned enum
mapSysfsString return code is checked for negativity after being casted
to unsigned enum type, which will always be false. This is obviously
unintended behaviour.

Fixes tautological-unsigned-enum-zero-compare warning.

Bug: 72331526
Test: m
Change-Id: Icec76d7a1121cb56fd9d05feb70cede69954c322
2018-03-02 18:42:03 +00:00
Todd Poynor
4d7ee2ebbb healthd: don't report fake data for battery-less devices
If the kernel does not implement a power_supply class device of type
battery, do not report fake data, instead report the following by
default:

* batteryPresent = false (instead of true),
* charging status = unknown (instead of charging),
* capacity = 0 (instead of 100%),
* health = unknown (instead of good),
* AC charger online not modified (instead of forcing true)

If no charger and no battery devices are supplied by the kernel, the
AC charger online property will no longer be forced to true.  Devices
that are always plugged into AC power should either implement a
power_supply class charger device or implement a Health HAL that sets
properties appropriately.

Bug: 34507420
Test: manual: gce_x6_phone (no battery or charger),
      boots and stays booted, inspect properties
Merged-In: I14cb3b685e8130428e417e7d08c4246f7415210a

Change-Id: I64bd4431af10f3d232f36fcf8d356b6d88b08013
2018-02-05 19:48:30 +00:00
Elliott Hughes
3289b9c928 Merge "Add OWNERS." 2017-12-07 23:21:26 +00:00
Elliott Hughes
693d63f9cf Add OWNERS.
Bug: N/A
Test: N/A
Change-Id: Ie785058c0f5eb9b4086c98ccba6e63e3ed411b65
2017-12-07 13:30:03 -08:00
Elliott Hughes
a3524a255f resolve merge conflicts of 796987482 to stage-aosp-master am: bb5ec4a926
am: 314ddcd9a3

Change-Id: I4fee960013f5539d85613eb09e365ee580ed1745
2017-10-17 21:57:49 +00:00
Elliott Hughes
bb5ec4a926 resolve merge conflicts of 796987482 to stage-aosp-master
Test: I solemnly swear I tested this conflict resolution.
Change-Id: Ica884c137c5f21e261600b2b011ab963036c0cdb
2017-10-17 12:36:14 -07:00
Elliott Hughes
a0f73f9bff <stdbool.h> not necessary in C++.
Bug: N/A
Test: builds
Change-Id: I1f32b202e353414e74ace87a7d5b495b5deb5f99
Merged-In: I1f32b202e353414e74ace87a7d5b495b5deb5f99
2017-10-17 16:21:33 +00:00
Luke Song
23471afe84 resolve merge conflicts of 74a5f22d9 to oc-dr1-dev-plus-aosp
Test: I solemnly swear I tested this conflict resolution.

Change-Id: Iad367b2998311e327151dbd8e9295259f6661f77
2017-07-19 18:25:51 -07:00
Luke Song
1d540dd0f4 healthd: restructure healthd_mode_charger
Refactor drawing code into separate class, and allow for split screen
drawing with offset.

Cherry picked from commit 7f386dcab9

Bug: 63541890
Test: Verify charging mode animation
Change-Id: I6c089460f55b8c2f75f4aa3153a5736f6f434b51
2017-07-19 22:46:54 +00:00
Luke Song
7f386dcab9 healthd: restructure healthd_mode_charger
Refactor drawing code into separate class, and allow for split screen
drawing with offset.

Bug: 63541890
Test: Verify charging mode animation
Change-Id: I6c089460f55b8c2f75f4aa3153a5736f6f434b51
2017-07-18 15:06:46 -07:00
Steven Moreland
1b13eea81f Added libhealthd-headers.
Test: use with BOARD_VNDK_VERSION=current
Change-Id: Icece8e543307498f349d7f4914ec5be6d97e98fc
2017-07-10 16:05:51 -07:00
Todd Poynor
51741d2f50 Merge "healthd: notify listeners using local copy of list, drop lock"
am: e29a6cda31

Change-Id: I94c6b076148c65e82ef13fc75b4be15b3e930901
2017-06-29 22:29:36 +00:00
Todd Poynor
8bd30b3cf3 healthd: notify listeners using local copy of list, drop lock
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
2017-06-29 22:25:40 +00:00
Mark Salyzyn
ca0c0bb96e Merge changes Ibe1feb39,I05be83e4,If1422e4d am: a4f086ab20
am: 3a156e6c2b

Change-Id: I8c75910845dbf6dfbb50ad38eb234dcd68dce70f
2017-06-27 21:55:26 +00:00
Todd Poynor
a1f4cddfea healthd: notify listeners using local copy of list, drop lock
am: fd68370074

Change-Id: I8b8c8bb2b2eede878bb44afcaa08f73142a10d64
2017-06-27 21:52:29 +00:00
Mark Salyzyn
3a156e6c2b Merge changes Ibe1feb39,I05be83e4,If1422e4d
am: a4f086ab20

Change-Id: I7e5d431c992f9860ca7b42ca81edfbfd1d8e0a1c
2017-06-27 21:52:06 +00:00
Todd Poynor
fd68370074 healthd: notify listeners using local copy of list, drop lock
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
2017-06-27 11:58:17 -07:00
Mark Salyzyn
26f1dd764c healthd: check console-ramoops-0
On later kernels /sys/fs/pstore/console-ramoops becomes
/sys/fs/pstore/console-ramoops-0

Test: none
Bug: 63058217
Change-Id: I05be83e40dfc1730ed62b74a146123cdb8573ca6
2017-06-27 09:28:57 -07:00
Yueyao Zhu
8e5671f55c Merge "healthd: add battery health status values from JEITA spec" am: 5dd87c4ef6
am: 7a79592e4e

Change-Id: Ife13b29af4f44d3d6f5cc7b00435f4c6a57e0d2b
2017-06-21 19:29:25 +00:00
Yueyao Zhu
9bbfbf7ffe healthd: add battery health status values from JEITA spec
Some vendors implement JEITA battery health spec.

Bug: 35780570
Test: build and boot
Change-Id: I532cd0fbdbcae0a32879de7d7930f3ccb8605ffd
2017-06-20 18:08:51 -07:00
Adam Lesinski
f04daccae9 Merge "healthd: Implement scheduleUpdate" am: 6edabc75ab am: c0405200b8
am: 50094d9865

Change-Id: I75976e5d4d4a38fb0fcb9e0cb5bf33a5786b146d
2017-03-23 01:12:17 +00:00
Adam Lesinski
c0405200b8 Merge "healthd: Implement scheduleUpdate"
am: 6edabc75ab

Change-Id: I80082322b77cbd74b70b4d3c25e172d1c51f6072
2017-03-23 00:48:48 +00:00
Adam Lesinski
3dec1aa66d healthd: Implement scheduleUpdate
scheduleUpdate forces a healthd battery update,
which will notify all listeners.
Test: Manual (strace -p $healthd_pid)
Bug: 32645990

Change-Id: I8b19f79b633ca8988f0e3dd5be14757f6421ddcb
2017-03-22 12:15:11 -07:00
Steven Moreland
aa47993b23 Merge "libutils: String\d+ make std_string private" am: 76850afa52 am: 2ebb1e5404
am: 4ba3f784ef

Change-Id: I14f003992db222ef285551c6d9a8ffe71620f70d
2017-03-11 09:07:23 +00:00
Steven Moreland
2ebb1e5404 Merge "libutils: String\d+ make std_string private"
am: 76850afa52

Change-Id: I1d8278c7545c67a916977983d38ea82756a17403
2017-03-11 08:59:48 +00:00
Steven Moreland
2aac335128 libutils: String\d+ make std_string private
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
2017-03-10 22:51:55 -08:00
TreeHugger Robot
068e00b3c9 Merge "Revert "Add BMS as a Battery type"" 2017-03-06 23:34:59 +00:00
Yueyao Zhu
8d17bc6a7a Revert "Add BMS as a Battery type"
This reverts commit f13c6ff50a.

Bug: 34166515
Change-Id: I102d3ee071f214deba1a72738af62b6f6b7c52f4
2017-03-06 21:42:35 +00:00
Chris Phoenix
68f4085e07 health HAL uses "default" service name
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
2017-02-23 19:32:29 +00:00
Jin Qian
72adf11daf healthd: return battery status property
Bug: 34198239
Change-Id: Ib0f312c15eb75ba7482f4f0b3f30ba2feae2c209
2017-02-07 21:41:05 +00:00
Todd Poynor
c8183bb071 healthd: charger mode use reboot(), not android_reboot()
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
2017-02-02 04:00:54 +00:00
Tao Bao
3d34631dbe Merge "healthd: Track the API change of minui/minui.h." am: fb8c70cf4b am: 93e35655c4 am: bf90005832
am: a2285a6a3e

Change-Id: I6573b527bd7d405203d2e8fd063358ad031065a1
2017-01-25 00:59:02 +00:00
Tao Bao
bf90005832 Merge "healthd: Track the API change of minui/minui.h." am: fb8c70cf4b
am: 93e35655c4

Change-Id: Ic77cd6f293d2875e251def1e75aff33a612d7077
2017-01-25 00:56:07 +00:00
Tao Bao
92c260159a healthd: Track the API change of minui/minui.h.
ev_init() and ev_iterate_available_keys() now take std::function
callback functions.

Test: mmma system/core/healthd
Change-Id: I8231b57ba816fcba8f698dd7145724021e235664
2017-01-18 23:02:45 -08:00
Adam Lesinski
f13c6ff50a Add BMS as a Battery type
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
2016-12-09 19:23:46 -08:00
Nick Vaccaro
9291de89b9 healthd: Show animation before waiting on timer
am: 6f8314900f

Change-Id: I4fd5665ff1b7ce646aa0b515aeb38152a340d8a1
2016-11-29 21:40:59 +00:00
Nick Vaccaro
485c647432 resolve merge conflicts of e3083de to nyc-mr1-dev-plus-aosp
Change-Id: Iba35210bc2133d79b2ba8ceb63e355507c7c0f03
2016-11-29 11:28:26 -08:00
Damien Bargiacchi
fdce0878f1 Always show the battery percentage unless it is unknown
am: 3f0250c3cc

Change-Id: If5027f2fc94aaf1f2db1d6df79866185e2cfe86d
2016-11-29 19:10:58 +00:00
Nick Vaccaro
1e811fca22 resolve merge conflicts of 1f1a6fd to nyc-mr1-dev-plus-aosp
Change-Id: Ic07b6db6f47d2157aef0d04d025ba747d0a4247d
2016-11-28 14:58:30 -08:00
Yifan Hong
62e840fc44 Split libhidl into base and transport.
Bug: 32756130

Test: mma
Change-Id: I1b897d3984b0faf636d40b862b14872ce5d5aa9b
2016-11-17 14:45:11 -08:00
Sandeep Patil
a3681954b4 healthd: start using the new Health hal
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>
2016-11-10 15:19:24 -08:00
Sandeep Patil
526f8cf339 healthd: refactor healthd code to split into 'charger' and 'healthd'
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>
2016-11-08 07:36:07 -08:00
Sandeep Patil
6012db553c healthd: build 'charger' and 'healthd' binaries
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>
2016-11-08 07:36:07 -08:00
Sandeep Patil
fca8244080 healthd: refactor to split charger and framework facing code
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>
2016-11-08 07:35:55 -08:00
Nick Vaccaro
c3c947a7bc healthd: Show animation before waiting on timer am: 6f8314900f
am: 2ed637210e

Change-Id: Ibb768d6760a13a9b25a40fabd0fcf8cb283fdba9
2016-10-27 04:02:17 +00:00
Nick Vaccaro
6f8314900f healthd: Show animation before waiting on timer
Don't wait for first timer to expire before starting animation.

Bug: 32368190
Change-Id: If023e3a9f1dd0c3982c899bcf22e5335f9319f72
2016-10-26 19:41:21 -07:00
Tom Cherry
836a404525 resolve merge conflicts of 4897bb5 to nyc-mr2-dev-plus-aosp
Change-Id: Iacad26a1b27d032e7abd1c7c23a8ee87d61d0aa4
2016-10-24 22:15:12 -07:00
Nick Vaccaro
4897bb57e4 Enable CHARGER_ENABLE_SUSPEND to allow suspend
am: e3083dec0f

Change-Id: I58f35c426ccd6030664743c3f49adbc5af7102b2
2016-10-25 04:25:04 +00:00