Skip to content

Android: Follow System Rotation setting (fixes landscape lock on foldable inner screens) - #270

Open
byaletheya-sudo wants to merge 1 commit into
OpenBubbles:rustpushfrom
byaletheya-sudo:fix/fold-system-rotation
Open

byaletheya-sudo wants to merge 1 commit into
OpenBubbles:rustpushfrom
byaletheya-sudo:fix/fold-system-rotation

Conversation

@byaletheya-sudo

@byaletheya-sudo byaletheya-sudo commented Sep 17, 2026

Copy link
Copy Markdown

Fixes #256.

Cause. SystemChrome.setPreferredOrientations([landscapeRight, landscapeLeft, portraitUp]) maps in the Flutter engine (PlatformChannel.decodeOrientations, mask 0x0b) 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 can only be used sideways when unfolded. Apps that request no orientation get SCREEN_ORIENTATION_UNSPECIFIED and the system's own foldable handling.

Change. A new systemRotation setting (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 analyze reports no new diagnostics against rustpush.

🤖 Generated with Claude Code

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Incorrect screen orientation handling / landscape lock on Galaxy Z Fold 8 inner screen

1 participant