Open Bug 1054113 Opened 6 years ago Updated 3 months ago

Firefox for Android should support W3C WakeLock API

Categories

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

ARM
Android
enhancement

Tracking

()

Tracking Status
fennec + ---

People

(Reporter: wlach, Unassigned)

References

(Depends on 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
Duplicate of this bug: 1520469
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
You need to log in before you can comment on or make changes to this bug.