ScreenOrientation.lock() should reject with NotSupportedError on large-screen Android 16+ devices (sw > 600dp)
Categories
(Firefox for Android :: Tooling, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox153 | --- | fixed |
People
(Reporter: mcarare, Assigned: mcarare)
References
Details
(Whiteboard: [fxdroid][group6] )
Attachments
(1 external file)
Since Android 16 (API 36), the OS ignores setRequestedOrientation() calls on displays whose smallest width exceeds 600dp (phones in landscape, tablets, foldables in unfolded state, etc.). This is a platform-level restriction that was introduced in Android 16 and made permanent in Android 17 (the developer opt-out available in Android 16 will be removed).
The Screen Orientation API spec requires lock() to return a promise rejected with NotSupportedError when the user agent does not support locking the screen orientation:
If the user agent does not support locking the screen orientation to orientation, return a promise rejected with a "NotSupportedError" DOMException.
Currently, on large-screen Android 16+ devices, screen.orientation.lock() resolves successfully even though the orientation lock is silently ignored by the OS. The promise should instead be rejected with NotSupportedError.
Updated•6 months ago
|
Comment 1•6 months ago
•
|
||
If not supported, https://searchfox.org/firefox-main/rev/10725540f638ba15d8138079dab01ecbac808be5/mobile/android/android-components/components/feature/session/src/main/java/mozilla/components/feature/session/ScreenOrientationFeature.kt#28-30 should return false (this will be denied), or https://searchfox.org/firefox-main/rev/10725540f638ba15d8138079dab01ecbac808be5/mobile/android/android-components/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/activity/GeckoScreenOrientationDelegate.kt#21-30 returns null.
| Assignee | ||
Updated•6 months ago
|
| Assignee | ||
Comment 2•6 months ago
|
||
- Replaced the
Booleanreturn type ofOrientationDelegate.onOrientationLockwith a newLockResultenum (SUCCESS,REJECTED,NOT_SUPPORTED). - Updated
ScreenOrientationFeatureto returnNOT_SUPPORTEDwhen running on Android Baklava or newer if the device has a large screen (> 600dp) or is in multi-window mode. - Adjusted
GeckoScreenOrientationDelegateto mapLockResult.SUCCESStoALLOW,REJECTEDtoDENY, andNOT_SUPPORTEDto an exceptional completion.
Comment 4•6 months ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox for Android::Tooling' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 5•6 months ago
|
||
| bugherder | ||
Description
•