We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3448 - [android][patch] declare one more configuration change to be handled by the app
Summary: [android][patch] declare one more configuration change to be handled by the app
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.1
Hardware: All Android (All)
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-07 05:12 UTC by Daniel Sobe
Modified: 2017-05-19 19:06 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Sobe 2016-10-07 05:12:12 UTC
Starting with Android API 13, another configuration change must be declared to be handled by the app if it is desired to not let the system handle rotation itself:

https://developer.android.com/guide/topics/resources/runtime-changes.html#HandlingTheChange

This will have effect if either a developer or SDL per default will set target API > 12. Currently it is set to 12, but this might change in the future, like when applying this patch: https://bugzilla.libsdl.org/show_bug.cgi?id=3445

The effect of not having this change applied is that the SDL app is destroyed upon rotation. Even when the manifest has an additional entry to e.g. always stay in landscape mode, the onDestroy() call will happen on devices that are portrait per default, when switching off screen due to power save. The device will then (at least try to) rotate into portrait to show the portrait screen lock after resume.

I believe it is safe to apply this patch even with target API still set to 12, the additional parameter is simply ignored.

--- SDL_snapshot/android-project/AndroidManifest.xml	2016-10-02 09:27:31.000000000 +0200
+++ SDL_merged/android-project/AndroidManifest.xml	2016-10-07 07:02:09.175813465 +0200
@@ -36,7 +36,7 @@
                  android:hardwareAccelerated="true" >
         <activity android:name="SDLActivity"
                   android:label="@string/app_name"
-                  android:configChanges="keyboardHidden|orientation"
+                  android:configChanges="keyboardHidden|orientation|screenSize"
                   >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
Comment 1 Ryan C. Gordon 2017-05-19 19:06:37 UTC
This change is now https://hg.libsdl.org/SDL/rev/1f151426c2ca, thanks!

--ryan.