Closed Bug 891259 Opened 11 years ago Closed 11 years ago

[Battery] battery.chargingTime and battery.dischargingTime do no work.

Categories

(Firefox OS Graveyard :: General, defect)

All
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: askeing, Assigned: tzimmermann)

References

()

Details

(Whiteboard: [fixed-in-birch])

Attachments

(1 file)

Device: Unagi - master/v1-train Leo - partner v1.1.0 build Nexus4 - master The WebAPI "navigator.battery.chargingTime" and "navigator.battery.dischargingTime" do not work. They always return None.
Log: >>> var keys = []; var bat = navigator.battery; for(var key in bat){ keys.push(key); }; return keys; [u'charging', u'chargingTime', u'dischargingTime', u'level', u'onchargingchange', u'onchargingtimechange', u'ondischargingtimechange', u'onlevelchange', u'addEventListener', u'removeEventListener', u'dispatchEvent'] >>> return navigator.battery.level 0.99 >>> return navigator.battery.charging True >>> return navigator.battery.chargingTime None >>> return navigator.battery.dischargingTime None
That's because the operating system's interfaces do not provide this information. I think there have been ideas about computing an estimated charging time from discrete charge values.
Blocks: gonk-jb
> That's because the operating system's interfaces do not provide this > information. I think there have been ideas about computing an estimated > charging time from discrete charge values. None still isn't correct in that situation per W3C spec: http://www.w3.org/TR/battery-status/ "The chargingTime attribute must be set to [...] positive Infinity if if the battery is discharging, the implementation is unable to report the remaining charging time, or otherwise" "The dischargingTime attribute must be set to the value positive Infinity, if the battery is charging,the implementation is unable to report the remaining discharging time [...] or otherwise" So in this case, both should be Infinity because they're unable to report. I just hit another version of this problem with an older Unagi build: When on the charger, chargingTime is 0 and dischargingTime is Infinity. When off the charger, chargingTime is Infinity and dischargingTime is 0. The 0s aren't correct there, in my case, and both values should remain Infinity there as well.
No longer blocks: gonk-jb
I just tried this on a more recent Unagi engineering build. (20130709132728) These results are more current than comment 3's. chargingTime is 0 when the battery is fully charged on the charger; Infinity when it is not fully charged and on the charger; and Infinity when it is discharging. These values are correct per-spec, assuming that it can't calculate remaining time. dischargingTime is 0 when discharging, and Infinity when on the charger. The 0 is incorrect; it should be Infinity if it can't calculate discharging time while discharging.
Assignee: nobody → tzimmermann
Status: NEW → ASSIGNED
I see. This patch fixes the the internal logic of the battery backend.
Attachment #773167 - Flags: review?(mounir)
Comment on attachment 773167 [details] [diff] [review] [01] Bug 891259: Set discharging time to 'Infinity' Review of attachment 773167 [details] [diff] [review]: ----------------------------------------------------------------- Thanks Thomas :)
Attachment #773167 - Flags: review?(mounir) → review+
Whiteboard: [fixed-in-birch]
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: