Problem: On a OnePlus device (OxygenOS / ColorOS), the screen keeps auto-rotating even though the Auto-rotate toggle in the UI / Quick Settings is switched off.
Root cause: The visible OxygenOS toggle and the underlying Android framework flag
system.accelerometer_rotation can drift out of sync. The framework flag stays at 1
(rotation enabled) while the UI shows it off. OxygenOS's rotation-suggestion feature
can also silently re-assert rotation behaviour. The fix is to set the framework flags
directly with ADB.
Tested on a OnePlus 12R (CPH2493), OxygenOS — and verified to persist across a reboot.
# Is a device connected?
adb devices -l
# Read the actual framework flag (1 = auto-rotate ON, 0 = OFF)
adb shell settings get system accelerometer_rotation
# See every rotation-related key across all three namespaces
adb shell settings list system | grep -i rotat
adb shell settings list secure | grep -i rotat
adb shell settings list global | grep -i rotatIf accelerometer_rotation returns 1 while your UI toggle is off, that mismatch is the bug.
Useful related keys you may see:
| Key | Namespace | Meaning |
|---|---|---|
accelerometer_rotation |
system | Master auto-rotate flag (1 on / 0 off) |
user_rotation |
system | Locked orientation when auto-rotate is off (0 = portrait) |
show_rotation_suggestions |
secure | The nav-bar "rotate" suggestion button |
camera_autorotate |
secure | Face-based auto-rotate (if present) |
oplus_customize_quick_start_rotative_camera_enabled |
system | OnePlus rotative-camera feature |
# Force auto-rotate OFF at the framework level
adb shell settings put system accelerometer_rotation 0
# (Optional) kill the rotate-suggestion nag button that can re-trigger it
adb shell settings put secure show_rotation_suggestions 0
# Verify
adb shell settings get system accelerometer_rotation # -> 0
adb shell settings get secure show_rotation_suggestions # -> 0adb reboot
adb wait-for-device
# wait for full boot
until [ "$(adb shell getprop sys.boot_completed | tr -d '\r')" = "1" ]; do sleep 2; done
adb shell settings get system accelerometer_rotation # should still be 0These values are stored persistently and survived a reboot in testing. The one thing that will undo the fix is opening the auto-rotate switch in the OxygenOS Settings/Quick Settings UI and tapping it — that can re-write the framework flag. After applying the ADB fix, just don't touch the in-UI toggle.
Documented with help from Claude Code.