... that logs values for an arbitrary health info and
health config.
This allows health 2.1 HAL implementation to log the
updated health info struct, which is not stored in
BatteryMonitor.
Test: healthd kernel log has correct values
Bug: 179326883
Change-Id: I394ef3f317229f94f4db82de5635d9380c183394
not exist.
Bug: 163382088
Test: Ensure that, if the ./capacity_level does not exist,
that the device will shut down at 0 % SOC in an Health 2.1
implementation
Change-Id: I00822b4bfba5d823c1a30163ea6824e59d3aae32
/sys/class/power_supply/*/current_now should return uA and the HAL
expects uA too.
Test: VtsHalHealthV2_0TargetTest
Bug: 136717180
Change-Id: I675be1ae645413b9494af4a5d49955aad5bd4f2e
Some devices expose the battery state of stylus etc in sysfs,
in addition to the whole system's main battery. Android only
recognizes the first battery enumerated here. We need to
filter out such HID-specific battery to let Android correctly
monitor the main battery status.
Bug: 136111013
Test: CtsBatterySavingTestCases on arcada
Change-Id: I4cbf6e3bf883fb3d107bedd2849d8ad525538629
In commit 1d4368b494 ("[REFACTOR] healthd: BatteryMonitor
use health 2.1 types"), the mapSysfsString() function was
changed to return NULL instead of -1 on error.
Everywher else that function is used commit 1d4368b494
tweaked the return value check from (ret < 0) to (!ret),
but one spot was missed.
This patch corrects the one missed check so that we compare
against null rather then negative value, since the return
value can no longer be negative.
This issue was found by inspection, and I've not seen an actual
problem with it, but thought it should be corrected.
Change-Id: I0a6564274d01276352a5dc0660b8ffbe748b5fde
Signed-off-by: John Stultz <john.stultz@linaro.org>
HIDL enum values are zero initialized, not the first value
of the enum. They need to be initialized properly.
Test: pass
Change-Id: I2adb8b851e6ac607ac4f547a6a6600604d07816f
- batteryCurrentAverage
- batteryCapacityLevel
- batteryChargeTimeToFullNowSeconds
- batteryFullCapacityUah
Some of the fields are left 0 / UNKNOWN and will be
implemented in b/142260281.
Bug: 142260281
Test: lshal debug health 2.1 HAL shows these values
Change-Id: I8e462d612b39c16cfb3ae1b63b3e293153585c28
... instead of BatteryProperties. HealthInfo contains
much more information and is easy for health HAL impl
to use it.
Also add getHealthInfo* functions for health HAL
implentations to use.
Test: health VTS 2.0 test
Bug: 142260281
Change-Id: I188276788fd8f11e69f8e046b91a873afaa23457
split bool update() into three functions:
void update()
void logValues()
bool isChargerOnline
... so that it doesn't depend on healthd_board_battery_update and
healthd_mode_ops, which are deprecated.
Test: health 2.0 VTS test
Bug: 142260281
Change-Id: I65908a04bae00654213efb4b5569ced0a7e76076
In case some power supply paths should not be considered, add a black list
to the healthd_config to instruct BatteryMonitor of the power supply paths
to ignore on init.
Bug: 117903348
Change-Id: I6f9ddeff9351ad01772b43728ddc2627da81df2a
Signed-off-by: Thierry Strudel <tstrudel@google.com>
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
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
These are custom paths from early Android devices that the framework used to
read, and that code was copied into healthd. Removed because this is not
defined in upstream kernel.
Change-Id: I375a8a62610c1235d82c1f27568437b16e0f96a8
Fixes: 72824944
Test: health 2.0 VTS test
This reverts commit 1bc572dfe8.
The presubmit test that (incorrectly) fails on the original commit
has been marked @FlakyTest and a bug is failed on Assistant.
Bug: 34507420
Test: manual: gce_x6_phone (no battery or charger),
boots and stays booted, inspect properties,
presubmit tests on gce_x86
Change-Id: I5509bf5de9fceffdd5fd8abc3f1f4f6101119248
This reverts commit de610c9a0e.
Reason for revert: May trigger flakiness in CTS ActivityManagerAssistantStackTests.
Change-Id: I02f831048f7802d91331e67bd9006860e4572b92
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
Change-Id: I14cb3b685e8130428e417e7d08c4246f7415210a
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
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
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>
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)