Closed Bug 2037807 Opened 6 months ago Closed 6 months ago

ScreenOrientation.lock() should reject with NotSupportedError on large-screen Android 16+ devices (sw > 600dp)

Categories

(Firefox for Android :: Tooling, task)

All
Android
task

Tracking

()

RESOLVED FIXED
153 Branch
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.

Assignee: nobody → mcarare
Status: NEW → ASSIGNED
  • Replaced the Boolean return type of OrientationDelegate.onOrientationLock with a new LockResult enum (SUCCESS, REJECTED, NOT_SUPPORTED).
  • Updated ScreenOrientationFeature to return NOT_SUPPORTED when running on Android Baklava or newer if the device has a large screen (> 600dp) or is in multi-window mode.
  • Adjusted GeckoScreenOrientationDelegate to map LockResult.SUCCESS to ALLOW, REJECTED to DENY, and NOT_SUPPORTED to an exceptional completion.
Pushed by mcarare@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/3d513a8935ee https://hg.mozilla.org/integration/autoland/rev/fb1986f9f93e Update OrientationDelegate to return LockResult and handle platform orientation lock limitations r=android-reviewers,giorga,ohall

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.

Component: General → Tooling
Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 153 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: