Skip to content

ADFA-3084 | Respect system screen orientation lock#1050

Merged
jatezzz merged 1 commit intostagefrom
fix/ADFA-3084-respect-user-orientation-lock
Mar 9, 2026
Merged

ADFA-3084 | Respect system screen orientation lock#1050
jatezzz merged 1 commit intostagefrom
fix/ADFA-3084-respect-user-orientation-lock

Conversation

@jatezzz
Copy link
Collaborator

@jatezzz jatezzz commented Mar 6, 2026

Description

Updated setAdaptiveOrientation in OrientationUtilities.kt to use ActivityInfo.SCREEN_ORIENTATION_USER instead of SCREEN_ORIENTATION_SENSOR. This ensures the application correctly respects the user's system-level screen rotation lock settings rather than forcing rotation based purely on device hardware sensors.

Details

Before fix

Before.fix.mov

After fix

After.fix.mov

Ticket

ADFA-3084

Observation

This fixes the bug where the application would rotate in landscape mode even if the user explicitly locked the device's orientation.

@jatezzz jatezzz requested a review from a team March 6, 2026 18:33
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e9c8367b-a1e7-4283-a23c-e9bf545e4bca

📥 Commits

Reviewing files that changed from the base of the PR and between e2a3542 and 8de546a.

📒 Files selected for processing (1)
  • common/src/main/java/com/itsaky/androidide/utils/OrientationUtilities.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • common/src/main/java/com/itsaky/androidide/utils/OrientationUtilities.kt

📝 Walkthrough
  • Changed adaptive orientation setting from ActivityInfo.SCREEN_ORIENTATION_SENSOR to ActivityInfo.SCREEN_ORIENTATION_USER in OrientationUtilities.setAdaptiveOrientation.
  • The app now respects the system-level screen rotation lock (user preference) instead of forcing rotation based on device sensors.
  • Fixes issue where the app would rotate to landscape even when the user had locked device orientation.
  • Affects all activities using this helper (e.g., BaseIDEActivity, layout editor activity); those flows will now honor the system/user rotation setting.
  • Risks / Best practices:
    • Low regression surface: single-line change with limited scope.
    • Behavior change may affect automated UI tests or integrations that expected sensor-forced rotations—update tests that relied on the previous behavior.
    • Aligns with Android best practice to respect user/system preferences for screen orientation.

Walkthrough

Replaced the orientation mode constant in the adaptive orientation setter: switched from sensor-driven orientation to user-preference-driven orientation by changing SCREEN_ORIENTATION_SENSOR to SCREEN_ORIENTATION_USER in OrientationUtilities.kt.

Changes

Cohort / File(s) Summary
Orientation Configuration
common/src/main/java/com/itsaky/androidide/utils/OrientationUtilities.kt
Changed SCREEN_ORIENTATION_SENSORSCREEN_ORIENTATION_USER in setAdaptiveOrientation to use user preference as the orientation data source.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Poem

🐰 A gentle hop through orientation's way,
From sensor spins to the user's sway,
The screen now listens to preferer's say,
Quietly adapting throughout the day. 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: respecting system screen orientation lock, which directly matches the core modification made to the orientation setting behavior.
Description check ✅ Passed The description is directly related to the changeset, providing context about the bug fix, explaining the before/after behavior, and linking to the relevant ticket ADFA-3084.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/ADFA-3084-respect-user-orientation-lock

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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

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

@jatezzz jatezzz force-pushed the fix/ADFA-3084-respect-user-orientation-lock branch from 3d6e911 to e2a3542 Compare March 6, 2026 21:34
Update OrientationUtilities to use SCREEN_ORIENTATION_USER instead of SENSOR.
@jatezzz jatezzz force-pushed the fix/ADFA-3084-respect-user-orientation-lock branch from e2a3542 to 8de546a Compare March 9, 2026 13:13
@jatezzz jatezzz merged commit 5a56a46 into stage Mar 9, 2026
2 checks passed
@jatezzz jatezzz deleted the fix/ADFA-3084-respect-user-orientation-lock branch March 9, 2026 13:24
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.

2 participants