health: support Dock charging

Bug: 194012532
Test: Show dock type correctly
Signed-off-by: Jack Wu <wjack@google.com>
Change-Id: I6031d4c12a89317fdf98894ff4bec1cfc5dcfddf
This commit is contained in:
Jack Wu 2021-12-20 14:56:50 +08:00
parent ac91c7c9dd
commit 5b13512b89
4 changed files with 7 additions and 1 deletions

View file

@ -37,6 +37,7 @@ parcelable HealthInfo {
boolean chargerAcOnline;
boolean chargerUsbOnline;
boolean chargerWirelessOnline;
boolean chargerDockOnline;
int maxChargingCurrentMicroamps;
int maxChargingVoltageMicrovolts;
android.hardware.health.BatteryStatus batteryStatus;

View file

@ -39,6 +39,10 @@ parcelable HealthInfo {
* Wireless charger state - 'true' if online
*/
boolean chargerWirelessOnline;
/**
* Dock charger state - 'true' if online
*/
boolean chargerDockOnline;
/**
* Maximum charging current supported by charger in µA
*/

View file

@ -61,7 +61,7 @@ void HalHealthLoop::OnHealthInfoChanged(const HealthInfo& health_info) {
void HalHealthLoop::set_charger_online(const HealthInfo& health_info) {
charger_online_ = health_info.chargerAcOnline || health_info.chargerUsbOnline ||
health_info.chargerWirelessOnline;
health_info.chargerWirelessOnline || health_info.chargerDockOnline;
}
} // namespace aidl::android::hardware::health

View file

@ -22,6 +22,7 @@ void convert(const HealthInfo& info, struct ::android::BatteryProperties* p) {
p->chargerAcOnline = info.chargerAcOnline;
p->chargerUsbOnline = info.chargerUsbOnline;
p->chargerWirelessOnline = info.chargerWirelessOnline;
p->chargerDockOnline = info.chargerDockOnline;
p->maxChargingCurrent = info.maxChargingCurrentMicroamps;
p->maxChargingVoltage = info.maxChargingVoltageMicrovolts;
p->batteryStatus = static_cast<int>(info.batteryStatus);