- client (Android): forget hysteresis policy; don't compute if < 95% charged.

This commit is contained in:
David Anderson 2013-02-11 16:36:20 -08:00 committed by Oliver Bock
parent 8d71408978
commit 6352f9ca9d
1 changed files with 3 additions and 15 deletions

View File

@ -277,25 +277,13 @@ int CLIENT_STATE::check_suspend_processing() {
// on some devices, running jobs can drain the battery even // on some devices, running jobs can drain the battery even
// while it's recharging. // while it's recharging.
// So use the following hysteresis policy: // So compute only if 95% charged or more.
// start computing when the batter is 95% charged.
// stop computing if it falls below 90%.
// Repeat.
// //
static bool hyst_state = true;
int cp = host_info.battery_charge_pct; int cp = host_info.battery_charge_pct;
if (cp >= 0) { if (cp >= 0)
if (cp < 90) {
hyst_state = true;
return SUSPEND_REASON_BATTERY_CHARGING;
}
if (cp < 95) { if (cp < 95) {
if (hyst_state) {
return SUSPEND_REASON_BATTERY_CHARGING; return SUSPEND_REASON_BATTERY_CHARGING;
} }
} else {
hyst_state = false;
}
} }
#endif #endif