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

Android: Properly handle rotations #3356

Merged
merged 1 commit into from
Feb 24, 2025

Conversation

Ghabry
Copy link
Member

@Ghabry Ghabry commented Feb 23, 2025

ConfigurationChanged is not sent on all Android versions because of various bugs in the operating system. Instead SurfaceChanged is used which is consistent with what SDL does.

Also Window events are not filtered anymore when in the background. This is required on Android, otherwise rotations are lost.


Confirmed by lusciouslover in chat that the rotation issue is fixed.

ConfigurationChanged is not sent on all Android versions because of various bugs in the operating system.
Instead SurfaceChanged is used which is consistent with what SDL does.

Also Window events are not filtered anymore when in the background.
This is required on Android, otherwise rotations are lost.
@Ghabry Ghabry added the Android label Feb 23, 2025
@Ghabry Ghabry added this to the 0.8.1 milestone Feb 23, 2025
@Ghabry Ghabry requested a review from fdelapena February 24, 2025 15:41
@fdelapena fdelapena merged commit ab5df15 into EasyRPG:master Feb 24, 2025
15 checks passed
@Ghabry
Copy link
Member Author

Ghabry commented Feb 24, 2025

Here the Android documentation about this btw (with remarks by me)


On Android 7.0 (API level 24) and higher, Activity recreation only occurs for size-based configuration changes if the size change is significant (?? What is Significant ??). When the system doesn't recreate an Activity due to insufficient size, the system might call Activity.onConfigurationChanged() and View.onConfigurationChanged() instead.

There are some caveats to observe regarding the Activity and View callbacks when the Activity isn't recreated:

  • On Android 11 (API level 30) through Android 13 (API level 33), Activity.onConfigurationChanged() isn't called. (<-- !!!)
  • There is a known issue where View.onConfigurationChanged() may not be called in some cases on Android 12L (API level 32) and early versions of Android 13 (API level 33). This has since been addressed in later Android 13 releases and Android 14. (<-- !!!)

For code that is dependent on listening for size-based configuration changes, we recommend using a utility View with an overridden View.onConfigurationChanged() instead of relying on Activity recreation or Activity.onConfigurationChanged(). Well yeah except when its broken on Android 13 -_-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants