Commit graph

80 commits

Author SHA1 Message Date
Yifan Hong
e438211a0f health 2.1 implementation.
Test: VTS health 2.1 test
Bug: 137670450

Change-Id: I04ea74facbaa534eee00a51474a013db3b6eb212
2019-10-30 11:15:24 -07:00
Treehugger Robot
d57bd9622a Merge "[REFACTOR] health 2.0: battery monitor returns health info 2.0" 2019-10-29 03:52:54 +00:00
Yifan Hong
17fad82187 Merge "[REFACTOR] health 2.0: BatteryMonitor::update split into 3 funcs" 2019-10-22 22:47:40 +00:00
Treehugger Robot
9a41dd7f5a Merge changes from topic "libhealthloop"
* changes:
  [REFACTOR] health 2.0: healthd_common -> libhealthloop
  health 2.0: Move healthd_common.cpp
2019-10-21 20:01:48 +00:00
Yifan Hong
00ebc75aef [REFACTOR] health 2.0: battery monitor returns health info 2.0
BatteryMonitor returns HealthInfo structs directly. Modify
code to adapt to this behavior.

Test: health VTS test 2.0
Bug: 142260281
Change-Id: I5e6605e46bb4f8bb08c1356e5f2233880e6f9d14
2019-10-15 17:38:40 -07:00
Robin Lee
ac5a0d316b health VTS: Status::UNKNOWN is OK if not present
Documentation: https://source.android.com/devices/tech/power/batteryless

If a battery device is not detected, the following battery-related
defaults are used on Android 9 and higher:

* Present:              false
* Status:               unknown
* Remaining capacity:   0
* Health:               unknown
* AC charger online:    not modified

The previous version of the test failed devices if the vendor HAL
reported BatteryStatus::UNKNOWN. However, the tests were skipped if the
default HAL was the one being used, so this has not come up before for
other batteryless devices.

Bug: 142081126
Test: vts-tradefed run vts -m VtsHalHealthV2_0
Change-Id: I8ca758677478b47511e24990fee545fafa6c7f83
2019-10-15 20:44:07 +02:00
Yifan Hong
9521b9d458 [REFACTOR] health 2.0: BatteryMonitor::update split into 3 funcs
BatteryMonitor::update no longer calls healthd_board_battery_update
and callback for us.

Test: VTS health HAL 2.0 test
Change-Id: I05fbf60b7e2c38f82e019d2fec2b5f535defaeae
2019-10-14 15:24:21 -07:00
Yifan Hong
50c9e25251 [REFACTOR] health 2.0: healthd_common -> libhealthloop
This change converts the original healthd_common.cpp to a
C++ class, HealthLoop, that manages the infinite loop in health-related
modules (charger, health HAL, healthd, etc.). By doing so, the global
static variables (including FDs and healthd_mode_ops) are cleaned up.

This helps us implement health HAL 2.1.

In order to support legacy modules (namely, healthd, charger, health HAL
2.0, which all depends on android.hardware.health@2.0-impl), a
healthd_common_adapter.cpp file is added to
android.hardware.health@2.0-impl, so that the following functions
in healthd/healthd.h continues to be implemented using the global
healthd_mode_ops:
    - healthd_register_event
    - healthd_battery_update_internal

Test: boot up the device and run VTS test on health HAL.
Bug: 137670450
Bug: 142260281
Change-Id: Iadcfc1315155404a3600f0e1219b5bc370d96409
2019-10-14 15:24:21 -07:00
Yifan Hong
c04b0a3e20 health 2.0: Move healthd_common.cpp
... so that the next CL has less diff.

Test: see next CL.
Change-Id: I5be187ab859a0b26d615b5ba7af9a26a07880181
2019-10-14 15:24:21 -07:00
Steven Moreland
b3a4d3832e Remove libhwbinder/libhidltransport deps
Since these were combined into libhidlbase.

Bug: 135686713
Test: build only (libhwbinder/libhidltransport are empty)
Change-Id: I075670b64eebbbbd6a6ae0e84ad51bf1c6f5ba36
2019-09-06 01:07:02 +00:00
Steven Moreland
1ae4615d9f Update hidl makefiles for bpfmt
hidl-generated makefiles are now generated such that bpfmt(file) == file.

Bug: 67417008
Test: enable bpfmt hook
Change-Id: I1f69d292bc23a7cc293a66110cb02d597e1019ad
2019-04-17 09:38:50 -07:00
Yifan Hong
03b2a3477b health vts: implement GTEST_SKIP if not defined.
gtest in Android P tree does not have GTEST_SKIP. Implement
a naive version of it.

Bug: 118852225
Test: manually undefine GTEST_SKIP, test with and without --force
Change-Id: I8df1154d8a94a67ae28e8024de6022fcfe76384d
2019-03-08 15:00:48 -08:00
Treehugger Robot
ace1da7c5b Merge "health: skip VTS on healthd if vendor HAL is present." 2019-03-08 03:18:13 +00:00
Yifan Hong
e6807ddec1 health: skip VTS on healthd if vendor HAL is present.
If vendor HAL is present, healthd is not used by the framework. VTS should
skip testing it when this is the case.

Provide a --force option to the test if one wants to test healthd.

Fixes: 118852225
Test: on walleye, test healthd with and without --force.

Change-Id: I85f792f25406b1c02887a0ac273730e719003e2f
2019-03-07 13:05:11 -08:00
Steven Moreland
a878aee9ab Update makefies: no 'types'
Bug: 123976090
Test: N/A
Change-Id: I30fb04c81889b62775e1b764b965fdb0f893de17
2019-03-04 11:27:17 -08:00
Felix
1fe2196f11 health: Add CAP_WAKE_ALARM to service
health/2.0/default/healthd_common.cpp wants to use
timerfd_create() to register a wakealarm.

To use the timerfd_create() syscall with CLOCK_BOOTTIME_ALARM,
CAP_WAKE_ALARM is needed.

Update the README to reflect the needed cap in the init file,
see also https://r.android.com/861532

Since the v1.0 HAL is in passthrough mode, the cap is needed for the 1.0
service as well.

Change-Id: I0e71da125eeef1360b5fd8bc7a69285e0b786511
Signed-off-by: Felix <google@ix5.org>
2019-01-06 16:07:50 +00:00
Felix
6a2b1b084a health: Fix typos in README
Change-Id: I64eb6cdaaccf30cf96d273db4e8d434d6ea90c51
Signed-off-by: Felix <google@ix5.org>
2019-01-04 19:57:12 +01:00
Nick Kralevich
8c038f2a2f healthd_common.cpp: use epoll_create1
epoll_create leaks file descriptors. Use epoll_create1(EPOLL_CLOEXEC)
instead.

Bug: 120983106
Test: compiles and boots
Change-Id: I50aad9f1c0633add2b44fb22be73dd292a366f39
2018-12-15 11:36:47 -08:00
Keun Soo YIM
68ae05dd2d pack VTS cc_test binaries as general-tests
Test: make general-tests
Bug: 120093339
Merged-In: I363450d205868f900e4925ccff1430e2a569f2a4
Change-Id: I363450d205868f900e4925ccff1430e2a569f2a4
2018-12-07 10:49:56 -08:00
Yifan Hong
f8a8873ee6 Merge "health VTS: split Properties test" 2018-10-02 23:37:43 +00:00
Yifan Hong
26c1200e54 health VTS: split Properties test
... into multiple test cases.
Test: run test

Change-Id: I2a03a7ab01d2918b746e06f55c2ee6d733ab4021
2018-10-02 14:54:28 -07:00
Yifan Hong
e9fc235eb4 health: registerCallback() and getHealthInfo() does not notify all callbacks
registerCallback() and getHealthInfo() unintentionally broadcast
health info to all callbacks, which has a performance impact.

* registerCallback() still invokes the new callback immediately
* getHealthInfo() does not call any callbacks at all.

Test: VTS test call getHealthInfo does not invoke update()
Bug: 117167903
Change-Id: Ida99fdd73831e747fbf2d65089c7c0e7661fe7c4
2018-10-02 14:30:03 -07:00
Yifan Hong
a46c0dae81 health: use recursive_mutex.
Need to use an reentrant lock.

Bug: 117167903
Test: vts
Change-Id: I25a366e06ed9d983823f7276668b7f45ddcf1c2b
2018-10-02 14:30:03 -07:00
Hridya Valsaraju
bf0b9faaad Initialize healthd_mode_ops in recovery default Health HAL impl.
This is required for correct functioning of getHealthInfo() API
in recovery since BatteryMonitor requires healthd_mode_ops to be
initialized to update battery properties.

Bug: 78793464
Test: fastboot getvar battery-voltage
Change-Id: I9ff77664cada22e4aa3668bfb7d28d5f1d45590b
2018-09-28 21:30:20 +00:00
Yifan Hong
6ab518e0df libhealthhalutils is recovery_available
Test: build it with recovery
Bug: 80132328
Change-Id: I0728b9a900577cc41cb8acb3d70dd0afb507fb2a
2018-08-13 12:55:36 -07:00
Yifan Hong
388897c3f2 health: convert README to markdown format.
Test: none
Change-Id: Ic9503d43a5e69cee0deb901193a99154d68f67b0
Fixes: 112277698
2018-08-08 11:06:51 -07:00
Steven Moreland
2ea3fa5cc1 IWYU: healthd IPCThreadState
Bug: 65843592
Test: m
Change-Id: I6f235c8a851079f335cfbc15b9bdb6f9d34d91fe
2018-08-01 01:23:53 +00:00
Yifan Hong
4db762a4d9 healthd: add android.hardware.health@2.0-impl-default.recovery
Test: build recovery
Bug: 80132328
Change-Id: I253bd1a756f3b94f6470da12bfc4488313a16aa4
2018-07-18 16:04:39 -07:00
Yifan Hong
ad35b35621 health@2.0-impl: recovery_available: true
... so that it can be installed to recovery image.
Test: build and inspect out dir
Test: boot to recovery and 'adb shell ls /vendor/lib64/hw'
Bug: 80132328

Change-Id: Icb33c9e9e648b54db33cac23ed877392cce4e76b
Merged-In: Icb33c9e9e648b54db33cac23ed877392cce4e76b
(cherry picked from commit 4e40086d39)
2018-07-18 11:28:12 -07:00
Yifan Hong
b21b03dd35 health: libhealthstoragedefault: recovery_available
Test: builds
Bug: 80132328

Change-Id: I2c4d880968e6938806cb9a2cf65352c73748f4ce
Merged-In: I2c4d880968e6938806cb9a2cf65352c73748f4ce
(cherry picked from commit 14d4383762)
2018-07-18 11:28:08 -07:00
TreeHugger Robot
456c9ebbcf Merge "healthd use vintf_fragments" into stage-aosp-master 2018-07-17 22:07:51 +00:00
Yifan Hong
c4a3421bc8 healthd use vintf_fragments
This encourages device manufacturers to use
service.override over service and to remove healthd
on device, because it is one less step to do.

Test: make VINTF metadata
Bug: 66917623
Change-Id: I447395450060cdf17731514bb9a5e3ed912bbc66
Merged-In: I447395450060cdf17731514bb9a5e3ed912bbc66
(cherry picked from commit ae005c4610)
2018-07-17 11:58:23 -07:00
Yifan Hong
51b29c99d4 health: remove unused flag HEALTHD_USE_HEALTH_2_0
Test: boots
Bug: 79107699
Change-Id: Idc27ad452b799ef2ce4f18c787f2aa2afd1dd8cf
(cherry picked from commit 1ffc50ad70)
2018-07-17 17:55:40 +00:00
Steven Moreland
c90461c738 rename hidl_enum_{iterator,range}
This is actually a range, not an iterator.

Bug: 78573628
Test: m
Change-Id: Ie824a3eabcb7d5af94a8752e1498bdc8c7032e40
2018-05-02 00:06:33 +00:00
TreeHugger Robot
2b2ffe64d6 Merge "Remove DiskStat checks from VTS Health HAL test" into pi-dev 2018-04-10 19:24:31 +00:00
Yifan Hong
7f8caede5f Merge "health: update readme for writing kmesg" into pi-dev 2018-04-06 21:03:34 +00:00
Yifan Hong
d7b297df83 health: update readme for writing kmesg
Test: none
Bug: 77661605
Change-Id: Iea07a8361e7c23919515d8550d90d2bd329e616a
2018-04-05 19:11:10 -07:00
TreeHugger Robot
6acac5a356 Merge "health: expand debug info." into pi-dev 2018-04-05 18:40:15 +00:00
Yifan Hong
81b2833a2f health: expand debug info.
Test: lshal -m android.hardware.health@2.0::IHealth/default
Test: lshal -m android.hardware.health@2.0::IHealth/backup

Bug: 74057048
Change-Id: Iaca0a7fd32209522d7d759342b98d6e6898595ac
2018-04-04 22:32:53 +00:00
Yifan Hong
8ef2335fe0 health 2.0: update readme to uninstall healthd
Test: none
Bug: 77541952

Change-Id: I44191f2d9f4a6d328c0ec96212c2add3b02874ca
2018-04-04 14:25:00 -07:00
Hridya Valsaraju
075c182f4d Remove DiskStat checks from VTS Health HAL test
The fields being checked were uint64_t and it
is valid for them to have any value greater than
or equal to zero.

Bug: 74057048
Test: vts-tradefed run vts -m VtsHalHealthV2_0
Change-Id: If932e1d6af8e162b7c570a1d5dd0f5ddce89ad1e
2018-04-03 18:24:34 +00:00
Yifan Hong
9fe3cc4e34 health 2.0: update README for typo. am: de542acbbf am: 6271c38c90
am: a9e9f9182d

Change-Id: Ia2997a95ca4034e79895197c56206e0cd0a7a379
2018-01-31 02:33:45 +00:00
Yifan Hong
de542acbbf health 2.0: update README for typo.
Test: none
Change-Id: Iaede40e22b909a06592dceedb3b430232ced0b1a
2018-01-30 15:32:30 -08:00
Yifan Hong
3e6dbcbc30 health: add README.
Test: none
Bug: 63702641
Change-Id: I1d23c0cdf56516585e7c6dd0db577784baa7b74e
Merged-In: I1d23c0cdf56516585e7c6dd0db577784baa7b74e
2018-01-30 15:06:21 -08:00
Steven Moreland
5d1e41a8fd Update makefiles.
Bug: N/A
Test: N/A
Change-Id: Idb1d74aeed9b82ca6568c76f35552f3fcc894239
2018-01-23 19:44:19 +00:00
Yifan Hong
fed3bfa4bc health: add README.
Test: none
Bug: 63702641
Change-Id: I1d23c0cdf56516585e7c6dd0db577784baa7b74e
2018-01-22 12:53:15 -08:00
Yifan Hong
4ad11a9474 health: move duplicate HealthServiceCommon
... to hardware/interfaces. HealthServiceCommon
becomes two separate libraries:
- libhealthservicedefault for services on vendor
- libhealthservicehealthd for healthd

Test: boots
Bug: 63702641
Change-Id: I40235cef7d4fa62103629bf507b0401e3f939654
2018-01-22 12:49:13 -08:00
Yifan Hong
75a2fb5441 health: move util modules to utils/
Test: pass
Change-Id: I5eb5202d75e26146d0d40fb726a0722cf8bf9e0f
2018-01-22 12:39:33 -08:00
TreeHugger Robot
6cb4a2ae36 Merge "Modify IHealthInfoCallback interface to return V2.0 HealthInfo" 2018-01-19 01:55:28 +00:00
Hridya Valsaraju
d31932aa67 Modify IHealthInfoCallback interface to return V2.0 HealthInfo
Bug: 71860528
Test: vts-tradefed run vts -m VtsHalHealthV2_0
Change-Id: Ie7294efa644442825baa5f08c39553c10b368e75
2018-01-18 21:24:12 +00:00