From 6352f9ca9d7ff85d2e9038c9a52ad31b7d1bcab6 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 11 Feb 2013 16:36:20 -0800 Subject: [PATCH] - client (Android): forget hysteresis policy; don't compute if < 95% charged. --- client/cs_prefs.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/client/cs_prefs.cpp b/client/cs_prefs.cpp index 07c420cbd2..c684bb0b6a 100644 --- a/client/cs_prefs.cpp +++ b/client/cs_prefs.cpp @@ -277,24 +277,12 @@ int CLIENT_STATE::check_suspend_processing() { // on some devices, running jobs can drain the battery even // while it's recharging. - // So use the following hysteresis policy: - // start computing when the batter is 95% charged. - // stop computing if it falls below 90%. - // Repeat. + // So compute only if 95% charged or more. // - static bool hyst_state = true; int cp = host_info.battery_charge_pct; - if (cp >= 0) { - if (cp < 90) { - hyst_state = true; - return SUSPEND_REASON_BATTERY_CHARGING; - } + if (cp >= 0) if (cp < 95) { - if (hyst_state) { - return SUSPEND_REASON_BATTERY_CHARGING; - } - } else { - hyst_state = false; + return SUSPEND_REASON_BATTERY_CHARGING; } } #endif