Commit graph

155 commits

Author SHA1 Message Date
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
TreeHugger Robot
085c91bedd Merge "Enable CHARGER_ENABLE_SUSPEND to allow suspend" into cw-f-dev 2016-10-25 04:16:25 +00:00
Damien Bargiacchi
2f65bf3e37 Always show the battery percentage unless it is unknown am: 3f0250c3cc
am: 44437259dd

Change-Id: I5f18055d0d04e642ebcc9fea4b713c1dc3298cfc
2016-10-25 01:36:50 +00:00
Damien Bargiacchi
44437259dd Always show the battery percentage unless it is unknown
am: 3f0250c3cc

Change-Id: I6e759572904fb7f505528812266fc48ecc8afd49
2016-10-25 01:33:50 +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
e204690ae7 resolve merge conflicts of 7c5aeb0 to nyc-mr2-dev-plus-aosp
Test: make healthd
Change-Id: I6dd20f5da5d2a9858d49db5556d8956a67ebf962
2016-10-24 14:07:35 -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
Yabin Cui
f6dbc6d4b8 healthd: separate libbatterymonitor for use in recovery.
Bug: 26879394

Change-Id: I97b5b4994c42988ce43f5085b8b4b25e9e80c9fa
(cherry picked from commit e98e177a34)
2016-02-23 10:52:43 -08:00
Yabin Cui
ac3387b71b healthd: init members of BatteryMonitor.
Bug: 26879394
Change-Id: I09a6c78137f91a0c88bf4ba1e8890b4ec31dcf2c
(cherry picked from commit db04a49a6f)
2016-02-23 10:46:38 -08:00