BatteryDefender: Explicitly set wireless path to reduce errors logs
For gs101 devices, we must detect whether a wireless charger exists at runtime, otherwise we'd need to create separate Health.cpp for each product in order to instantiate the wireless path correctly. Test: Ensure battery defender triggers via wireless connection. Ensure there are no warnings for devices that do not have a wireless charger Bug: 165954398 Change-Id: Ibba202293141c017d3048980b643a80b5fb57ca4
This commit is contained in:
parent
934721c1e0
commit
331796ed8d
1 changed files with 6 additions and 2 deletions
|
@ -62,7 +62,9 @@ constexpr char kBatteryResistance[] {FG_DIR "/resistance"};
|
|||
constexpr char kBatteryOCV[] {FG_DIR "/voltage_ocv"};
|
||||
constexpr char kVoltageAvg[] {FG_DIR "/voltage_now"};
|
||||
|
||||
static BatteryDefender battDefender;
|
||||
#define WLC_DIR "/sys/class/power_supply/wireless"
|
||||
|
||||
static BatteryDefender battDefender(WLC_DIR "/present");
|
||||
static BatteryThermalControl battThermalControl(
|
||||
"dev/thermal/tz-by-name/soc/mode");
|
||||
static BatteryMetricsLogger battMetricsLogger(kBatteryResistance, kBatteryOCV);
|
||||
|
@ -84,7 +86,6 @@ static uint16_t lifetimeB;
|
|||
static std::chrono::system_clock::time_point ufs_last_query_time;
|
||||
constexpr auto kUfsQueryIntervalHours = std::chrono::hours{24};
|
||||
|
||||
#define WLC_DIR "/sys/class/power_supply/wireless"
|
||||
static bool needs_wlc_updates = false;
|
||||
constexpr char kWlcCapacity[]{WLC_DIR "/capacity"};
|
||||
|
||||
|
@ -132,6 +133,9 @@ void private_healthd_board_init(struct healthd_config *hc) {
|
|||
ChargerDetect::populateTcpmPsyName(&tcpmPsyName);
|
||||
hc->ignorePowerSupplyNames.push_back(android::String8(tcpmPsyName.c_str()));
|
||||
needs_wlc_updates = FileExists(kWlcCapacity);
|
||||
if (needs_wlc_updates == false) {
|
||||
battDefender.setWirelessNotSupported();
|
||||
}
|
||||
}
|
||||
|
||||
int private_healthd_board_battery_update(struct android::BatteryProperties *props) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue