Booting up the device without usb, the kernel sets the usb power supply
type as UNKNOWN. The type of usb power supply changes at run-time as
various chargers are plugged in/out. However, healthd initilizes the
charger list only at bootup. Change it such that it checks for charger
type changes with every battery or usb uevent.
While at it, the kernel may have a power supply type which is not known
to healthd. This is perfectly fine. Update healthd to not print a
warning.
Change-Id: I2ec9f9a420ca61814d43c316b418ce94de3691bc
HVDCP_3 is a high voltage DCP charger where the charger's voltage
can be changed by issuing pulses on the D+/D- lines. Add support to
recognize it and treat it as an AC power source.
Change-Id: Ib719529904e8b7a676bbdc5f5953f0f9da6df3fa
This reverts commit aeccbb8f3a.
Reason for revert: needed for debug and investigations of battery and charging issues. The tooling depends on these lines (and have been for years). You should have these lines only on SOC changes and in the presence of a serious problem. Please do not remove logging without consulting with the BMS SW team first.
Change-Id: Ife0079a7e0c1499b22e843429832b019139c0d89
This is log spam and fills the kernel log. Reduce log level from warning
to debug.
Test: manual
Bug: 36785118
Change-Id: I70fc3a0d796cb1a984705236fe7527e266a69a03
Signed-off-by: Neill Kapron <nkapron@google.com>
This string was added to sysfs fairly recently. It indicates that
re-calibration is needed, which we've already added an indicator for via
the INCONSISTENT health status.
Bug: 300585313
Test: m
Change-Id: I9594523e509ad94480ad13f489eee6d1c0a75e7e
Add BATTERY_PROP_PART_STATUS support via getProperty.
Add serial number support via a new helper function, since it doesn't
fit neatly into the BatteryProperty structure.
There are no sysfs nodes for this yet, so currently it is stubbed.
Bug: 309792384
Test: fastboot getvar battery-part-status
fastboot getvar battery-serial-number
Change-Id: I3777e092d4ef26c02a7dd5420c9eaf1ec5aeae92
This empty method is different from the old one - it aligns with
std::string definition.
Bug: 295394788
Test: make checkbuild
Change-Id: Id6baed8cde01a75a8839ad6b4475a31ba1f49c8a
Report Battery health INCONSISTENT when there is a battery recalibration
pending.
Bug: 283182048
Test: m
Change-Id: I8b944ddac7cc919fc95b1b71b015101642a62f96
Signed-off-by: Jack Wu <wjack@google.com>
Battery health is supported but there is not enough information to
determine an accurate value This is a temporary state.
Bug: 276400004
Test: m
Change-Id: I0d422db20c51ef7e9dc4fa904729beda625c9fea
Signed-off-by: Jack Wu <wjack@google.com>
Based on a new system property. This won't change any behavior if that
new system property isn't set.
Ignore-AOSP-First: WearOS specific change
Upstreaming from Wear: b/272526799
Bug: 199404658
Test: set the property, check that off-mode-charging automatically
reboots
(cherry picked from commit 332b3686290af70c73a464ce35b0c1124b2ce831)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:82d8011f170d5b1c936d117f4fb74836333714b6)
Merged-In: I98f37a840a43cb5216319457027b76fc493e3f62
Change-Id: I98f37a840a43cb5216319457027b76fc493e3f62
NOTE FOR REVIEWERS - original patch and result patch are not identical.
PLEASE REVIEW CAREFULLY.
Diffs between the patches:
0,6 +620,18 @@
kick_animation(&batt_anim_);
}
health_info_ = health_info;
+
+ if (property_get_bool("ro.charger_mode_autoboot", false)) {
+ if (health_info_.battery_level >= boot_min_cap_) {
+ if (property_get_bool("ro.enable_boot_charger_mode", false)) {
+ LOGW("booting from charger mode\n");
+ property_set("sys.boot_from_charger_mode", "1");
+ } else {
+ LOGW("Battery SOC = %d%%, Automatically rebooting\n", health_info_.battery_level);
+ reboot(RB_AUTOBOOT);
+ }
+ }
+ }
}
int Charger::OnPrepareToWait(void) {
Original patch:
From 82d8011f170d5b1c936d117f4fb74836333714b6 Mon Sep 17 00:00:00 2001
From: Alice Sheng <alicesheng@google.com>
Date: Fri, 18 Mar 2022 10:25:31 -0700
Subject: [PATCH] Add ability to automatically bootup
Based on a new system property. This won't change any behavior if that
new system property isn't set.
Ignore-AOSP-First: WearOS specific change
Bug: 199404658
Test: set the property, check that off-mode-charging automatically
reboots
Change-Id: I98f37a840a43cb5216319457027b76fc493e3f62
(cherry picked from commit 332b3686290af70c73a464ce35b0c1124b2ce831)
---
skip drawing UI for max 5 seconds if battery level is not ready.
Bug: 265896703
Test: confirm offmode charge UI behavior
Change-Id: I11ae3419749be8d3c1d8d8e61eb4446d276ac1ad
Signed-off-by: Jack Wu <wjack@google.com>
libbatterymonitor_V1 is used for some libraries linking health
aidl_interface V1 but at the same time BatteryMonitor also uses
battery hal V2 structure, it will cause compiling error.
Folk BatteryMonitor is also required along with folk libbatterymonitor
Bug: 251425963
Test: build
Change-Id: I796db83b1a67ad63e7f75f966e829a790b5c9c89
Signed-off-by: Jack Wu <wjack@google.com>
Requirements for battery health aidl hal v2, include sysfs nodes:
- Battery state of health
- Charging state
- Charging policy
- Date of manufacturing of the battery
- Date of first use of the battery
and functions
- setChargingPolicy
- getChargingPolicy
- getBatteryHealthData
Bug: 251425963
Test: m
Change-Id: I210dc403ba95b1b75759227f84bc32f32be1bbaf
Signed-off-by: Jack Wu <wjack@google.com>
When health aidl_interface version updraged, some libraries are
depending on V1 and libbatterymonitor or libhealthd_charger_ui at
the same time. It will cause multiple versions depending if
libbatterymonitor or libhealthd_charger_ui are depending on new
version.
Fork libbatterymonitor and libhealthd_charger_ui to generate two
versions, so that other libraries can depend on the same aidl_interface
version, to avoid multiple versions depending.
Bug: 251425963
Test: build
Change-Id: I37ba23169428677550176916e5d0b52c154d7b85
Signed-off-by: Jack Wu <wjack@google.com>
turn off both display after first display was turned off
Bug: 242967285
Test: charging animation can show in display correctly
Signed-off-by: Jack Wu <wjack@google.com>
Change-Id: Ie5741b49322aaf8a3750b1977fb203e4d0df3539
* According to healthd_mode_charger.cpp#L106 this should be
res/images/default/charger and not res/images/charger/default
Change-Id: Iabb5f5ecdd3b94c90a4b46849dd0a048da51364a
Create HealthdDraw in charger init beforce CreateDisplaySurface,
make sure minui gr_init pixel_format beforce gr_pixel_format.
Bug: 232441376
Test: 1. set ro.minui.pixel_format=ARGB_8888
2. Set a colorful battery_scale.png
3. Power off and enter charger mode.
Change-Id: If16f15d0a8bc3b7cb9dab7392f3753ec0a1525b8
The private methods in class BatteryMonitor do not use the 'this'
pointer. Hence convert these into static nonmember functions.
Test: Compile-tested only.
Change-Id: I4b9b76c9697f1db894ba9fb939ce096ee6b7ff3b
Signed-off-by: Bart Van Assche <bvanassche@google.com>
Not all readFromFile() callers pass an empty string. Make sure that
readFromFile() returns 0 (failure) if the *buf argument is not empty and
if reading fails.
Fixes: 3217c5c7d9 ("batterymonitor: simplify readFromFile and use std::string buffers")
Test: Compile-tested only.
Change-Id: I6f329491f8aa4a6d378eb7c3cbc17038eb6aa64d
Signed-off-by: Bart Van Assche <bvanassche@google.com>
Use aggregate initialization instead of memberwise initialization. This
patch does not change any functionality.
Test: Compile-tested only.
Change-Id: I9c7831936e449aec8a48336b1ee76d26638e4f72
Signed-off-by: Bart Van Assche <bvanassche@google.com>
Declare and assign in a single statement instead of in two separate
statements. This patch does not change any functionality.
Test: Compile-tested only.
Change-Id: I0798cc940f5f2ca329548568ab68e96891521dd8
Signed-off-by: Bart Van Assche <bvanassche@google.com>
This change cleans up technical debt. As a side
effect, this change also exposes chargerDockOnline
properly to health HAL implementations.
Test: TH
Bug: 222120465
Change-Id: I306bd0538d94b310a69befb93b5862dd7208447f
Bug: 191831427
Test: charging animation can show in display correctly
Signed-off-by: Jack Wu <wjack@google.com>
Change-Id: Iedcd7d6c3cd841c44bdf1116701abcbd12a26959
Bug: 191831427
Test: charging animation can show in display correctly
Signed-off-by: Jack Wu <wjack@google.com>
Change-Id: Id99a7401f53f647790e179e995dad9841f8284bb
set first connector as default
Test: charging animation can show in correct display
Bug: 191831427
Signed-off-by: Jack Wu <wjack@google.com>
Change-Id: Ia79981569e799f01db0036f0ecbdaca36a539ac6
For the vendor variant of libhealthd_mode_charger, read resources
from /vendor. The core variant continues to read resources from
/product, /system, and /res.
Test: run charger from /vendor manually
Bug: 203246116
Change-Id: Ia9df1d081a51783409b5dbd3e3d4719efc3cb6a7
This is a prerequisite to move charger to vendor partition.
Because vendor domains can't read ro.charger.*, they are all assumed
to be the default value. They aren't set in the ecosystem anyway,
so it is time to deprecate them.
Test: builds
Bug: 203246116
Change-Id: I0b17e62ab3ac5a89df091333fd9f24e33bdfd49a
The system property is set by vendor partition but owned by platform,
hence vendor domains can't read this value. Add an API in
ChargerConfigurationInterface so that HAL implementations can override
its value.
Other ro.charger.* sysprops are unused, hence no APIs are created for
them.
Test: manual
Bug: 203246116
Change-Id: I583c21e58ed3d912b156e253d6a4b46a0378f11e
Abstract all the HIDL-ness from charger so an AIDL HAL
can later replace the HIDL HAL.
Created libhealthd_charger_ui that is responsible for
UI stuff in charger. Then libhealthd_charger is now the
charger library backed by HIDL HAL.
Bug: 170338625
Bug: 203246116
Test: charger_test
Change-Id: I193bb76afa18b3367f24796ac53b1760650e8683
1.Retry charger when gr init fail caused
by display not ready.
2.Remove meaningless logs which occupy log lines,
the logs that really need to be printed cannot be
output due to printk suppresses kernel logs.
Bug: 197604278
Change-Id: Id9465a0a9c994986192fd39c124d05aed8caa862
Test: Manual. Power off charging.
... 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