-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement OS.get_screen_orientation() for Android #43022
Implement OS.get_screen_orientation() for Android #43022
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already fixed in master by e167af3. You can follow a similar approach.
Maybe there's some confusion over this proposed change. The implementation of This change introduces the logic for getting the device's actual orientation, is that not the more desirable behavior? If so, this change should also be forward-ported to |
@Klowner The master fix is actually the proper implementation. See the javadocs for Activity#getRequestedOrientation(). |
@m4gr3d okay, so the distinction between requested orientation and current orientation is the issue. As long as calling Thanks! |
@Klowner Not quite. The screen orientation for the current app is driven by two factor:
Godot uses both approach (in theory, there's another related bug we're fixing, see #39266). So at start time, the app uses the orientation value specified by the So requested orientation is the same as current orientation :) By the way, this PR is still needed since the fix for |
JNIEnv *env = ThreadAndroid::get_env(); | ||
return env->CallIntMethod(godot_io_instance, _get_screen_orientation); | ||
} else { | ||
return -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be safer to return 0
here. While incorrect, it would ensure that the value matches the OS::ScreenOrientation
enum.
@m4gr3d ah, thank you for directing me to that ticket and I apologize for misunderstanding. I didn't realize y'all had addressed the issue via other means. 👍 I'll rebase and swap the body of |
066083f
to
92ff6c5
Compare
Thanks! |
I'm fairly certain this fixes #17109, I'm also happy to do this as a change against
master
, but I can't get that to run on my android device at the moment 😃tested on my Google Pixel 3 👍