Skip to content

Support upside-down portrait rotation on phone-sized screens - #286

Open
milan-404 wants to merge 1 commit into
netbirdio:mainfrom
milan-404:main
Open

milan-404 wants to merge 1 commit into
netbirdio:mainfrom
milan-404:main

Conversation

@milan-404

@milan-404 milan-404 commented Oct 14, 2026 •

Copy link
Copy Markdown

Hello folks. This is my first contribution, just let me know if there are any issues!

Overview

I noticed that reverse portrait rotation was not supported for smartphone sized devices. With auto-rotate on, the display just snaps back to normal portrait. I hold my phone in all sorts of angles day to day, and I suspect other accessibility use cases would also benefit, so this PR enables it.

Change

Updated MainActivity: SCREEN_ORIENTATION_PORTRAIT -> SCREEN_ORIENTATION_SENSOR_PORTRAIT

Testing

Tested that rotation 0 and 180 correctly rotate the display. Horizontal rotations 90 and 270 are not impacted as this will required a new UI layout to fit each element.

AI Disclosure

Development and testing of this PR were assistant by a local AI coding assistant.

Summary by CodeRabbit

  • Bug Fixes
    • On supported Android phones with portrait lock enabled, the app can now rotate upside down while remaining in portrait orientation. Landscape orientation remains disabled.

@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

When lock_portrait is enabled on a non-TV Android device, MainActivity now requests sensor portrait orientation. This allows upside-down portrait rotation while excluding landscape.

Changes: Portrait orientation

Layer / File(s) Summary
Portrait-lock orientation request
app/src/main/java/io/netbird/client/MainActivity.java
The lock_portrait branch now requests SCREEN_ORIENTATION_SENSOR_PORTRAIT instead of SCREEN_ORIENTATION_PORTRAIT. The comment clarifies the portrait-lock behavior for phone-sized screens and landscape-only displays.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Feature

Suggested reviewers: pappz

Merge Risk: ⚪ Minimal · up to d83aa

The portrait-lock branch now permits reverse portrait even when Android Auto-rotate is off. No established issue blocks merging this behavior, subject to normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: enabling upside-down portrait rotation on phone-sized screens.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the turning screen
Portrait holds, yet spins upside-down
No landscape sneaks into the scene
The code now follows the sensor’s sound
And hops away with ears held high

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔇 Additional comments: 1
app/src/main/java/io/netbird/client/MainActivity.java-215-215: 1

215-215: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Honor the user's Auto-rotate setting.

SCREEN_ORIENTATION_SENSOR_PORTRAIT uses the sensor even when the user has locked rotation, so the app can rotate to 180° while Auto-rotate is off. If reverse portrait should be available only when the user permits sensor rotation, use SCREEN_ORIENTATION_USER_PORTRAIT, which follows the user's preference. (developer.android.com)


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d2eac824-b241-45a5-99b4-d251a119f3b4
📥 Commits

Reviewing files that changed from the base of the PR and between ad7865a and d83aae1.

📒 Files selected for processing: 1
  • app/src/main/java/io/netbird/client/MainActivity.java

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

This branch has not been deployed

No deployments
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.

1 participant