Android: prevent ignoring surfaceChanged() in MultiWindow
diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
index ff24ba8..fcdc1f8 100644
--- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
+++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
@@ -1739,6 +1739,8 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
SDLActivity.nativeSetScreenResolution(width, height, nDeviceWidth, nDeviceHeight, sdlFormat, mDisplay.getRefreshRate());
SDLActivity.onNativeResize();
+ // Prevent a screen distortion glitch,
+ // for instance when the device is in Landscape and a Portrait App is resumed.
boolean skip = false;
int requestedOrientation = SDLActivity.mSingleton.getRequestedOrientation();
@@ -1768,6 +1770,16 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
}
}
+ // Don't skip in MultiWindow.
+ if (skip) {
+ if (Build.VERSION.SDK_INT >= 24) {
+ if (SDLActivity.mSingleton.isInMultiWindowMode()) {
+ Log.v("SDL", "Don't skip in Multi-Window");
+ skip = false;
+ }
+ }
+ }
+
if (skip) {
Log.v("SDL", "Skip .. Surface is not ready.");
mIsSurfaceReady = false;