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)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: askeing, Assigned: tzimmermann)
References
()
Details
(Whiteboard: [fixed-in-birch])
Attachments
(1 file)
(deleted),
patch
|
mounir
:
review+
|
Details | Diff | Splinter Review |
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.
Reporter | ||
Comment 1•11 years ago
|
||
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
Assignee | ||
Comment 2•11 years ago
|
||
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.
> 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.
There's also a later editor's draft here:
https://dvcs.w3.org/hg/dap/raw-file/tip/battery/Overview.html
Same behavior applies.
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 | ||
Updated•11 years ago
|
Assignee: nobody → tzimmermann
Status: NEW → ASSIGNED
Assignee | ||
Comment 6•11 years ago
|
||
I see. This patch fixes the the internal logic of the battery backend.
Attachment #773167 -
Flags: review?(mounir)
Comment 7•11 years ago
|
||
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+
Assignee | ||
Comment 8•11 years ago
|
||
Thanks a lot!
https://hg.mozilla.org/projects/birch/rev/760459ccbc30
Whiteboard: [fixed-in-birch]
Comment 9•11 years ago
|
||
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.
Description
•