Android: un-needed transition to Pause state.
authorSylvain Becker <sylvain.becker@gmail.com>
Thu, 10 Jan 2019 15:29:37 +0100
changeset 12516d1d64b025981
parent 12515 5cd74fbb01d7
child 12517 608b59e27e10
Android: un-needed transition to Pause state.

- Don't need to go into Pause state, since onPause() has been called before.
- Don't need to call nativePause is SDLThread is already ended
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	Wed Jan 09 23:19:26 2019 +0100
     1.2 +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java	Thu Jan 10 15:29:37 2019 +0100
     1.3 @@ -98,7 +98,7 @@
     1.4          if (mMotionListener == null) {
     1.5              if (Build.VERSION.SDK_INT >= 26) {
     1.6                  mMotionListener = new SDLGenericMotionListener_API26();
     1.7 -            } else 
     1.8 +            } else
     1.9              if (Build.VERSION.SDK_INT >= 24) {
    1.10                  mMotionListener = new SDLGenericMotionListener_API24();
    1.11              } else {
    1.12 @@ -327,15 +327,15 @@
    1.13              case Surface.ROTATION_0:
    1.14                  result = SDL_ORIENTATION_PORTRAIT;
    1.15                  break;
    1.16 -    
    1.17 +
    1.18              case Surface.ROTATION_90:
    1.19                  result = SDL_ORIENTATION_LANDSCAPE;
    1.20                  break;
    1.21 -    
    1.22 +
    1.23              case Surface.ROTATION_180:
    1.24                  result = SDL_ORIENTATION_PORTRAIT_FLIPPED;
    1.25                  break;
    1.26 -    
    1.27 +
    1.28              case Surface.ROTATION_270:
    1.29                  result = SDL_ORIENTATION_LANDSCAPE_FLIPPED;
    1.30                  break;
    1.31 @@ -390,9 +390,6 @@
    1.32             return;
    1.33          }
    1.34  
    1.35 -        mNextNativeState = NativeState.PAUSED;
    1.36 -        SDLActivity.handleNativeState();
    1.37 -
    1.38          // Send a quit message to the application
    1.39          SDLActivity.mExitCalledFromJava = true;
    1.40          SDLActivity.nativeQuit();
    1.41 @@ -483,9 +480,12 @@
    1.42  
    1.43          // Try a transition to paused state
    1.44          if (mNextNativeState == NativeState.PAUSED) {
    1.45 -            nativePause();
    1.46 -            if (mSurface != null)
    1.47 +            if (mSDLThread != null) {
    1.48 +                nativePause();
    1.49 +            }
    1.50 +            if (mSurface != null) {
    1.51                  mSurface.handlePause();
    1.52 +            }
    1.53              mCurrentNativeState = mNextNativeState;
    1.54              return;
    1.55          }