Skip to content
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

Only rotate Android sensor values for sensors that need them rotated #55183

Merged
merged 1 commit into from
Dec 15, 2021

Conversation

madmiraal
Copy link
Contributor

Currently, on Android, onSensorChanged() calls Display.getRotation() whether or not it's needed. As identified by @ICatRegister, this may cause input dispatching to time out and the game to crash.

This PR ensures that Display.getRotation() is only called for sensors that need it. It also refactors the way the values are adjusted depending on the rotation to make it clearer what is being done.

Fixes #41421
Closes #53909

Copy link
Contributor

@m4gr3d m4gr3d left a comment

Choose a reason for hiding this comment

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

Similar comments as in #55184.

@madmiraal
Copy link
Contributor Author

I've added the missing break statements and added the validation of the float values[] parameter.

@akien-mga akien-mga merged commit e311389 into godotengine:master Dec 15, 2021
@akien-mga
Copy link
Member

Thanks!

@madmiraal madmiraal deleted the fix-41421 branch December 15, 2021 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

game crashes when ADS SDK initializes Sensor activity processing code crashes on Android
4 participants