Android: prevent ignoring surfaceChanged() in MultiWindow
authorSylvain Becker <sylvain.becker@gmail.com>
Tue, 18 Jun 2019 11:35:30 +0200
changeset 128748f76265cbd5b
parent 12873 160c6eede02c
child 12875 8c5077f79e7c
Android: prevent ignoring surfaceChanged() in MultiWindow
android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
     1.1 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java	Tue Jun 18 10:41:11 2019 +0200
     1.2 +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java	Tue Jun 18 11:35:30 2019 +0200
     1.3 @@ -1739,6 +1739,8 @@
     1.4          SDLActivity.nativeSetScreenResolution(width, height, nDeviceWidth, nDeviceHeight, sdlFormat, mDisplay.getRefreshRate());
     1.5          SDLActivity.onNativeResize();
     1.6  
     1.7 +        // Prevent a screen distortion glitch,
     1.8 +        // for instance when the device is in Landscape and a Portrait App is resumed.
     1.9          boolean skip = false;
    1.10          int requestedOrientation = SDLActivity.mSingleton.getRequestedOrientation();
    1.11  
    1.12 @@ -1768,6 +1770,16 @@
    1.13             }
    1.14          }
    1.15  
    1.16 +        // Don't skip in MultiWindow.
    1.17 +        if (skip) {
    1.18 +            if (Build.VERSION.SDK_INT >= 24) {
    1.19 +                if (SDLActivity.mSingleton.isInMultiWindowMode()) {
    1.20 +                    Log.v("SDL", "Don't skip in Multi-Window");
    1.21 +                    skip = false;
    1.22 +                }
    1.23 +            }
    1.24 +        }
    1.25 +
    1.26          if (skip) {
    1.27             Log.v("SDL", "Skip .. Surface is not ready.");
    1.28             mIsSurfaceReady = false;