From 918fe0624818e8b105687d96d2a1633702b7aef8 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 10 Jul 2013 15:47:30 +0200 Subject: [PATCH] Bug 891259: Set discharging time to 'Infinity', r=mounir If the discharging time is unknown, the W3C Battery Status API requires its value to be 'Infinity'. The current code returns a discharging time of 0 when discharging the battery. This patch fixes the problem. --- hal/gonk/GonkHal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hal/gonk/GonkHal.cpp b/hal/gonk/GonkHal.cpp index e6939fa9ae9d..6663f9583f5b 100644 --- a/hal/gonk/GonkHal.cpp +++ b/hal/gonk/GonkHal.cpp @@ -435,7 +435,7 @@ GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInfo) aBatteryInfo->charging() = true; } - if (aBatteryInfo->charging() && (aBatteryInfo->level() < 1.0)) { + if (!aBatteryInfo->charging() || (aBatteryInfo->level() < 1.0)) { aBatteryInfo->remainingTime() = dom::battery::kUnknownRemainingTime; } else { aBatteryInfo->remainingTime() = dom::battery::kDefaultRemainingTime;