fixup! healthd: Reinitialize mChargerNames for every battery update

Copy paste dock support from BatteryMonitor::init().

Change-Id: Iba587c318b92001ab7812f6b4d3433b5f17785f4
This commit is contained in:
LuK1337 2023-07-11 01:15:04 +02:00 committed by zlewchan
parent 9cb248617d
commit f2d8913afe

View file

@ -468,6 +468,7 @@ void BatteryMonitor::updateValues(void) {
case ANDROID_POWER_SUPPLY_TYPE_AC:
case ANDROID_POWER_SUPPLY_TYPE_USB:
case ANDROID_POWER_SUPPLY_TYPE_WIRELESS:
case ANDROID_POWER_SUPPLY_TYPE_DOCK:
path.clear();
path.appendFormat("%s/%s/online", POWER_SUPPLY_SYSFS_PATH, name);
if (access(path.string(), R_OK) == 0)
@ -476,6 +477,17 @@ void BatteryMonitor::updateValues(void) {
default:
break;
}
// Look for "is_dock" file
path.clear();
path.appendFormat("%s/%s/is_dock", POWER_SUPPLY_SYSFS_PATH, name);
if (access(path.string(), R_OK) == 0) {
path.clear();
path.appendFormat("%s/%s/online", POWER_SUPPLY_SYSFS_PATH, name);
if (access(path.string(), R_OK) == 0)
mChargerNames.add(String8(name));
}
}
}