summaryrefslogtreecommitdiff
path: root/health
diff options
context:
space:
mode:
authorStephane Lee <stayfan@google.com>2020-10-08 23:37:43 -0700
committerStephane Lee <stayfan@google.com>2020-10-15 16:25:42 -0700
commite7ea64063708c806cba5cac0bc85f52c522edf7e (patch)
tree6f96edea230148fef29817227b1575f9a74f922b /health
parent45892594994c2ccb180912d9e35d63b91d733fae (diff)
downloadpixel-e7ea64063708c806cba5cac0bc85f52c522edf7e.tar.gz
Ensure that a 5 minute disconnect will disable battery defender even if active
Test: 'atest HealthTestCases' Bug: 170449952 Change-Id: If2be0b8ab802a6af45a97f8fbb93348b33455e1f
Diffstat (limited to 'health')
-rw-r--r--health/BatteryDefender.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/health/BatteryDefender.cpp b/health/BatteryDefender.cpp
index 277f75a6..e7e80c43 100644
--- a/health/BatteryDefender.cpp
+++ b/health/BatteryDefender.cpp
@@ -236,13 +236,16 @@ BatteryDefender::state_E BatteryDefender::stateMachine_getNextState(const state_
case STATE_CONNECTED:
if (mTimeChargerPresentSecs > mTimeToActivateSecsModified) {
nextState = STATE_ACTIVE;
- } else if (mTimeChargerNotPresentSecs > kTimeToClearTimerSecs) {
+ }
+ FALLTHROUGH_INTENDED;
+
+ case STATE_ACTIVE:
+ if (mTimeChargerNotPresentSecs > kTimeToClearTimerSecs) {
nextState = STATE_DISCONNECTED;
}
+
break;
- case STATE_ACTIVE:
- // Latch unless disabled or unless the health module has restarted (ie. reboot)
default:
break;
}