Bug 1257618 - Kill bogus "level should increase" when charging message r?snorp
The battery level can decrease while we're trying to charge. Most commonly
many devices oscillate between 99% and 100% when fully charged. This situation
could also happen if the device is receiving less power than it's using. Therefore
we shouldn't treat this as an extraordinary situation.
MozReview-Commit-ID: eN3W9P5oty
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoBatteryManager.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoBatteryManager.java
@@ -123,17 +123,16 @@ public class GeckoBatteryManager extends
if (sLastLevelChange != 0) {
// Use elapsedRealtime() because we want to track time across device sleeps.
long currentTime = SystemClock.elapsedRealtime();
long dt = (currentTime - sLastLevelChange) / 1000;
double dLevel = sLevel - previousLevel;
if (sCharging) {
if (dLevel < 0) {
- Log.w(LOGTAG, "When charging, level should increase!");
sRemainingTime = kUnknownRemainingTime;
} else {
sRemainingTime = Math.round(dt / dLevel * (1.0 - sLevel));
}
} else {
if (dLevel > 0) {
Log.w(LOGTAG, "When discharging, level should decrease!");
sRemainingTime = kUnknownRemainingTime;