Commit graph

157 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
TreeHugger Robot
085c91bedd Merge "Enable CHARGER_ENABLE_SUSPEND to allow suspend" into cw-f-dev 2016-10-25 04:16:25 +00:00
TreeHugger Robot
cd542213e8 Merge "Always show the battery percentage unless it is unknown" into cw-f-dev 2016-10-25 01:28:06 +00:00
Damien Bargiacchi
3f0250c3cc Always show the battery percentage unless it is unknown
Bug: 29547343
Change-Id: I55630be8033cd8074628a892960b5fafe0c83338
2016-10-24 16:45:29 -07:00
Nick Vaccaro
e3083dec0f Enable CHARGER_ENABLE_SUSPEND to allow suspend
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
2016-10-24 13:58:49 -07:00
Nick Vaccaro
1f1a6fdac8 healthd: allow override of wake interval timing
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
2016-10-21 19:39:05 -07:00
Tim Murray
b9ede3dbba healthd: move binder fd to not use EPOLLWAKEUP am: e89ea5eb85
am: 098babc7c8

Change-Id: I9ff934ef70aa89c02edcc8687249655ad86d806f
2016-10-21 21:53:49 +00:00
Tim Murray
098babc7c8 healthd: move binder fd to not use EPOLLWAKEUP
am: e89ea5eb85

Change-Id: I2e5a55d3bc381baa679e39e63d37164f76ffdcfc
2016-10-21 21:49:50 +00:00
Tim Murray
e89ea5eb85 healthd: move binder fd to not use EPOLLWAKEUP
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
2016-10-21 09:11:49 -07:00
Elliott Hughes
7948a33f2c resolve merge conflicts of a4398c1 to stage-aosp-master am: 195669febc
am: b2ab1c43cb

Change-Id: I412943235ad6cd908aca04c56aa19a3d2bbb5413
2016-10-14 02:55:55 +00:00
Elliott Hughes
da46b392f1 Move off std::sto* function which abort on failure.
Bug: http://b/31403370
Test: builds, boots, libbase tests pass
Change-Id: I89cd7ca3d8f1c8a1bad0ddf3043439449d19a293
2016-10-13 15:34:05 -07:00
Damien Bargiacchi
afd59e2f11 resolve merge conflicts of 565ba02 to nyc-mr1-dev-plus-aosp
Change-Id: Ic2152775c96dc28f808fc7b97433f8c3d2135948
2016-09-13 08:37:37 -07:00
Damien Bargiacchi
565ba02b89 Allow customization of charger animation
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
2016-09-12 21:07:27 -07:00
Damien Bargiacchi
ada99f91b0 Update to new minui text API
am: 0ee524de68

Change-Id: I19341d2639b6efeb13eddaae1083252eeafc77fc
2016-08-24 20:45:17 +00:00
Damien Bargiacchi
0ee524de68 Update to new minui text API
Change-Id: Ic753564a397b90a9ba54660c78bec9c1a1ef583d
2016-08-18 17:33:32 -07:00
Chih-Hung Hsieh
119d41c18e Merge \"Fix clang-tidy performance warnings in healthd.\"
am: b66b16b39a

Change-Id: I1263c6557128d71dd4208d6a4d6974572d8362a3
2016-07-28 06:24:24 +00:00
Chih-Hung Hsieh
4df105635b Fix clang-tidy performance warnings in healthd.
* Use const reference type for parameters to avoid unnecessary copy.

Bug: 30407689
Change-Id: I926ea7b6e9e020a228c812b7e23087a2b7ed9809
Test: build with WITH_TIDY=1
2016-07-27 16:05:50 -07:00
Chih-Hung Hsieh
65828a0ec9 Merge \"Fix misc-macro-parentheses warnings in system/core.\"
am: 495541c5bb

Change-Id: I021b653779c5119398c31ee354372366ba029328
2016-06-22 22:39:07 +00:00
Treehugger Robot
495541c5bb Merge "Fix misc-macro-parentheses warnings in system/core." 2016-06-22 22:35:02 +00:00
Chih-Hung Hsieh
cdb2ca5d9f Fix misc-macro-parentheses warnings in system/core.
Add parentheses around macro arguments used beside operators.
Bug: 28705665

Change-Id: I9226f319e283be640eddc31687f75b51a8ef0ac6
2016-06-22 14:33:13 -07:00
Dmitry Shmidt
9f6b80c9c8 resolve merge conflicts of a617e33 to stage-aosp-master
Change-Id: I0d1e6b1771eebc38f7eea5a942395c5f8ff6a5ac
2016-06-20 12:58:37 -07:00
Michael Scott
3217c5c7d9 batterymonitor: simplify readFromFile and use std::string buffers
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>
2016-06-20 15:01:02 +00:00
Ruchi Kandoi
6e394f0f6c healthd: Check if battery device exists instead of charger drivers before setting fake properties. am: 9cb3d3ccf4
am: f2ca669e80

* commit 'f2ca669e80078254ad3aceac800161b3266d3195':
  healthd: Check if battery device exists instead of charger drivers before setting fake properties.

Change-Id: I8115836dbd81264634dd7ab84bc360ac610a030b
2016-05-17 18:23:04 +00:00
Ruchi Kandoi
9cb3d3ccf4 healthd: Check if battery device exists instead of charger drivers before
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)
2016-05-16 08:58:35 -07:00
Christopher Wiley
447ae54e3f Merge "Export libbinder headers from libhealhd.default" am: c2241b9
am: a10b760

* commit 'a10b760d28ee0327d84dd73a16a83927d695eb56':
  Export libbinder headers from libhealhd.default

Change-Id: Idad9032e89102e912240a3d26955d3f7893e0694
2016-04-18 17:15:08 +00:00
Christopher Wiley
8ac71c7fc6 Export libbinder headers from libhealhd.default
Consumers of libhealthd.default will need these headers.

Bug: 27804373
Change-Id: I59e8526e3491f0db528d1277b8e2f4b68ce85805
Test: Compiles.
2016-04-18 09:33:53 -07:00
Treehugger Robot
54cba246b8 Merge "healthd: Explicitly reference headers from libbinder" am: 911982d
am: c2fd0b6

* commit 'c2fd0b6e8966c554eb78d012cefd9d9685871700':
  healthd: Explicitly reference headers from libbinder

Change-Id: Ia3f2c9fad18f712c1089c119b247702a54c19f6e
2016-04-12 21:09:08 +00:00
Christopher Wiley
22399089ef healthd: Explicitly reference headers from libbinder
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
2016-04-12 13:07:18 -07:00
Ruchi Kandoi
8df54e7721 healthd: Add charge counter for BatteryProperties.
am: 3f9886b

* commit '3f9886bb0bce7297c676907ded51c402d7b61654':
  healthd: Add charge counter for BatteryProperties.

Change-Id: I4fbdeebcd50acae22712dde8a2192475051c9d96
2016-04-08 01:19:36 +00:00
Ruchi Kandoi
3f9886bb0b healthd: Add charge counter for BatteryProperties.
Bug: 27174034
Change-Id: I26de33714bb353faadb159d898f0b2142c76c657
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
2016-04-07 23:10:14 +00:00
Ruchi Kandoi
89e2d4dc67 Merge "healthd: Check if battery device exists instead of charger drivers before setting fake properties."
am: ed608b30b5

* commit 'ed608b30b5cb1d998f4d7a56cd0f85aa2bca5c5a':
  healthd: Check if battery device exists instead of charger drivers before setting fake properties.
2016-03-09 02:44:03 +00:00
Ruchi Kandoi
fabd490f58 healthd: Check if battery device exists instead of charger drivers before
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>
2016-03-08 22:28:25 +00:00
Ruchi Kandoi
39510201a3 Merge "healthd: Correct the scaling factor for maxVoltage and maxCurrent." into nyc-dev
am: 1d043484d4

* commit '1d043484d409d4d18eaf13aa1086f51fcee73587':
  healthd: Correct the scaling factor for maxVoltage and maxCurrent.
2016-02-26 21:29:48 +00:00
Ruchi Kandoi
5c09ec1726 healthd: Correct the scaling factor for maxVoltage and maxCurrent.
Change-Id: I93a4c916d0c742710c00c0b15d8d1de6b8f8d1c2
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
2016-02-26 10:09:28 -08:00
Badhri Jagan Sridharan
ef375c6583 Merge "healthd: Read the max power supply voltage" into nyc-dev
am: df09aefc16

* commit 'df09aefc1603903429d8fa7c4838a38a7c6dc8d3':
  healthd: Read the max power supply voltage
2016-02-25 20:30:12 +00:00
Badhri Jagan Sridharan
40e1df4488 healthd: Read the max power supply voltage
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
2016-02-25 12:15:54 -08:00
Yabin Cui
b0580d710f healthd: support reading charge status from BatteryMonitor.
recovery needs to know whether the battery is charged.

Bug: 26879394
Change-Id: Ie2a1d06e81878efa3ff432c2015d409a625e473e
(cherry picked from commit aedf6038dc)
2016-02-23 11:01:21 -08:00