Skip to content

Android: Properly handle rotations#3356

Merged
1 commit merged into
EasyRPG:masterfrom
Ghabry:android-screenfix
Feb 24, 2025
Merged

Android: Properly handle rotations#3356
1 commit merged into
EasyRPG:masterfrom
Ghabry:android-screenfix

Conversation

@Ghabry

@Ghabry Ghabry commented Feb 23, 2025

Copy link
Copy Markdown
Member

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 a user February 24, 2025 15:41
@ghost ghost merged commit ab5df15 into EasyRPG:master Feb 24, 2025
@Ghabry

Ghabry commented Feb 24, 2025

Copy link
Copy Markdown
Member Author

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 -_-

sevenc-nanashi pushed a commit to sevenc-nanashi/easyrpg-player that referenced this pull request May 31, 2026
Android: Properly handle rotations
This pull request was closed.
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.

1 participant