Health HAL: fix bug for level remap
Avoid abnormal level jump when overloading happens at 100%
and it's not in EoC case.
Bug: 128385708
Test: Verify passed
Change-Id: I13e038e77ec6386704e1f3365cd59a2ab6ee508a
Signed-off-by: Wasb Liu <wasbliu@google.com>
diff --git a/health/BatteryRechargingControl.cpp b/health/BatteryRechargingControl.cpp
index 4683aa8..687e975 100644
--- a/health/BatteryRechargingControl.cpp
+++ b/health/BatteryRechargingControl.cpp
@@ -95,7 +95,10 @@
state_ = WAIT_EOC;
recharge_soc_ = 0;
case WAIT_EOC:
- if (charger_status == kStatusIsFull) {
+ if (props->batteryLevel != kFullSoc) {
+ state_ = INACTIVE;
+ recharge_soc_ = 0;
+ } else if (charger_status == kStatusIsFull) {
state_ = RECHARGING_CYCLE;
props->batteryLevel = kFullSoc;
} else if (charger_status != kStatusIsCharging) {