Android: Follow System Rotation setting (fixes landscape lock on foldable inner screens) - #270
Open
byaletheya-sudo wants to merge 1 commit into
Open
byaletheya-sudo wants to merge 1 commit into
byaletheya-sudo wants to merge 1 commit into
Conversation
…able inner screens) SystemChrome.setPreferredOrientations([landscapeRight, landscapeLeft, portraitUp]) maps in the Flutter engine (PlatformChannel.decodeOrientations) to Android's SCREEN_ORIENTATION_USER. With rotation lock on, that mode pins the display's natural orientation, and on the Galaxy Z Fold inner panel the natural orientation is landscape, so the app could only be used sideways when unfolded (issue OpenBubbles#256). An empty list is SCREEN_ORIENTATION_UNSPECIFIED, the same as every app that requests no orientation, so the system's own foldable handling applies. This adds a "Follow System Rotation" switch (default on) that requests nothing on Android; turning it off restores the previous explicit list, and the existing "Allow Upside-Down Rotation" switch keeps working in that mode. Fixes OpenBubbles#256 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #256.
Cause.
SystemChrome.setPreferredOrientations([landscapeRight, landscapeLeft, portraitUp])maps in the Flutter engine (PlatformChannel.decodeOrientations, mask 0x0b) to Android'sSCREEN_ORIENTATION_USER. With rotation lock on, that mode pins the display's natural orientation, and on the Galaxy Z Fold inner panel the natural orientation is landscape, so the app can only be used sideways when unfolded. Apps that request no orientation getSCREEN_ORIENTATION_UNSPECIFIEDand the system's own foldable handling.Change. A new
systemRotationsetting (default on) makes the app request nothing on Android (setPreferredOrientations([])). A "Follow System Rotation" switch sits above "Allow Upside-Down Rotation" in Misc; turning it off restores the previous explicit list, and the upside-down switch keeps working in that mode. Three files, no behavior change on other platforms.Verification. Built as a release APK (arm64) from this branch and installed on a Galaxy Z Fold 8 (Android 16, One UI); the app runs and the switch appears in Misc. I could not exercise a registered account in a sideloaded build (registration needs the hosted service), so the orientation behavior in a live chat is inferred from the engine mapping above rather than observed there; a maintainer test on a foldable would be appreciated.
flutter analyzereports no new diagnostics againstrustpush.🤖 Generated with Claude Code