SDL
SDL copied to clipboard
Android bug: I can rotate screen and app rotates even when I locked screen rotation in system settings
Hello!
I can rotate screen and game rotates even when I locked screen rotation in system settings.
Test Devices:
- Xiaomi Mi 8 Lite (android 10)
- Xiaomi Redmi 8 (android 10)
- Samsung Galaxy A02s (android 11)
Tested Versions:
- 2.0.22
- 2.24.0
https://user-images.githubusercontent.com/97330399/185794999-a6299bb1-a708-44ac-8b12-518ad1988f63.mp4
This sounds like an OS-side bug.
This sounds like an OS-side bug.
Yes, but other apps has normal behavior. It is relevant to SDL apps but not to other
would it make sense to apply the fix used here?
https://github.com/exelix11/SysDVR/commit/81ffb43b4ee02f2b1b1926f1107df4213bb013d0
this is from one of the issues that mentions this one
The proper way to fix this is to use ActivityInfo.SCREEN_ORIENTATION_FULL_USER
instead of ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR
. The former will respect user's orientation lock in their navigation bar. This also can be applied to landscape or portrait-only orientation by using ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE
and ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
respectively. However be aware that the last 2 is Android 4.3+ and this may be need to be addressed in separate issue.
I can write patches to fix the first case (changing ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR
to ActivityInfo.SCREEN_ORIENTATION_FULL_USER
). However, simply changing them is considered behavior change. So I'd like to know @slouken thoughts on addressing this.
TL;DR:
- SDL uses
ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR
for resizable window or when it allows any orientation. -
ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR
does not respect user orientation lock in their status bar. -
ActivityInfo.SCREEN_ORIENTATION_FULL_USER
is the equivalent whilst respecting user orientation lock. - However, changing this can be considered behavior change.
Yes, we probably want to use FULL_USER for SDL 3.0, and possibly also for SDL 2.0
I believe this should be closed as completed as it's been fixed in 2.30.4.