Closed Bug 1054113 Opened 10 years ago Closed 3 years ago

Firefox for Android should support W3C WakeLock API

Categories

(Firefox for Android Graveyard :: General, enhancement, P5)

ARM
Android
enhancement

Tracking

(fennec+)

RESOLVED INCOMPLETE
Tracking Status
fennec + ---

People

(Reporter: wlach, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-needed, parity-chrome, Whiteboard: [lang=js])

I recently wrote up a meditation application and uploaded it to the Firefox marketplace:

https://marketplace.firefox.com/app/meditation

Unfortunately it doesn't work particularly well on Android, because the screen turns off while the timer is counting down and the end "chime" sound never plays. On FirefoxOS, I used the requestWakeLock API to avoid this problem:

https://developer.mozilla.org/en-US/docs/Web/API/Navigator.requestWakeLock API

... it would be great if Firefox for Android supported this as well.
tracking-fennec: --- → ?
This should be trivial. Add the wakelock pref (dom.wakelock.enabled) to the list of things to turn on in apps:

http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/WebappRT.js#27

If you have time/environment to do that, you're in a much better place to test the api than anyone else :)
Mentor: wjohnston
(In reply to Wesley Johnston (:wesj) from comment #1)
> This should be trivial. Add the wakelock pref (dom.wakelock.enabled) to the
> list of things to turn on in apps:
> 
> http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/
> WebappRT.js#27
> 
> If you have time/environment to do that, you're in a much better place to
> test the api than anyone else :)

I wonder if this should be usable by regular web pages as well though? As long as release the lock when the webpage is left, we should be fine, right? This is the way it works for FirefoxOS.
Flags: needinfo?(wjohnston)
Hmm... that would be interesting. I don't know enough about the topic to comment. Probably a good dev-platform post to see what people think.

The fix should also try and make sure the apk factory is updated to include the wake_lock pref is apps request it:
<uses-permission android:name="android.permission.WAKE_LOCK"/>
Flags: needinfo?(wjohnston)
tracking+ for now, but we can track for a release if we decide to do a webapp API-focused release.
tracking-fennec: ? → +
filter on [mass-p5]
Priority: -- → P5
Sounds like fixing this bug would just involve flipping a pref and doing some testing.
Whiteboard: [lang=js]
(In reply to :Margaret Leibovic from comment #6)
> Sounds like fixing this bug would just involve flipping a pref and doing
> some testing.

Yup, I think so. I really haven't had the time/inclination to work on it myself, but it would likely make a good first bug for someone who wants to get started. To test that it works, maybe just install my meditation app (https://marketplace.firefox.com/app/meditation/) and do a 5 minute session. Make sure the screen stays on for the duration.
There is now a W3C API for wake lock management: http://w3c.github.io/wake-lock/

It has been added an experimental feature in Chromium: https://codereview.chromium.org/1107333002/
Mentor: wjohnston2000
Blocks: 1589554
No longer blocks: 1589554
Depends on: 1589554

Changed title as the API's request method keeps changing :)

Summary: Firefox for Android should support Navigator.requestWakeLock API → Firefox for Android should support W3C WakeLock API
Type: defect → enhancement
Blocks: wakelock
We have completed our launch of our new Firefox on Android. The development of the new versions use GitHub for issue tracking. If the bug report still reproduces in a current version of [Firefox on Android nightly](https://play.google.com/store/apps/details?id=org.mozilla.fenix) an issue can be reported at the [Fenix GitHub project](https://github.com/mozilla-mobile/fenix/). If you want to discuss your report please use [Mozilla's chat](https://wiki.mozilla.org/Matrix#Connect_to_Matrix) server https://chat.mozilla.org and join the [#fenix](https://chat.mozilla.org/#/room/#fenix:mozilla.org) channel.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INCOMPLETE
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.