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
This commit is contained in:
Sylvain Becker 2019-01-10 15:29:37 +01:00
parent 8dd915507e
commit 61d37de099

View File

@ -98,7 +98,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
if (mMotionListener == null) { if (mMotionListener == null) {
if (Build.VERSION.SDK_INT >= 26) { if (Build.VERSION.SDK_INT >= 26) {
mMotionListener = new SDLGenericMotionListener_API26(); mMotionListener = new SDLGenericMotionListener_API26();
} else } else
if (Build.VERSION.SDK_INT >= 24) { if (Build.VERSION.SDK_INT >= 24) {
mMotionListener = new SDLGenericMotionListener_API24(); mMotionListener = new SDLGenericMotionListener_API24();
} else { } else {
@ -327,15 +327,15 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
case Surface.ROTATION_0: case Surface.ROTATION_0:
result = SDL_ORIENTATION_PORTRAIT; result = SDL_ORIENTATION_PORTRAIT;
break; break;
case Surface.ROTATION_90: case Surface.ROTATION_90:
result = SDL_ORIENTATION_LANDSCAPE; result = SDL_ORIENTATION_LANDSCAPE;
break; break;
case Surface.ROTATION_180: case Surface.ROTATION_180:
result = SDL_ORIENTATION_PORTRAIT_FLIPPED; result = SDL_ORIENTATION_PORTRAIT_FLIPPED;
break; break;
case Surface.ROTATION_270: case Surface.ROTATION_270:
result = SDL_ORIENTATION_LANDSCAPE_FLIPPED; result = SDL_ORIENTATION_LANDSCAPE_FLIPPED;
break; break;
@ -390,9 +390,6 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
return; return;
} }
mNextNativeState = NativeState.PAUSED;
SDLActivity.handleNativeState();
// Send a quit message to the application // Send a quit message to the application
SDLActivity.mExitCalledFromJava = true; SDLActivity.mExitCalledFromJava = true;
SDLActivity.nativeQuit(); SDLActivity.nativeQuit();
@ -483,9 +480,12 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
// Try a transition to paused state // Try a transition to paused state
if (mNextNativeState == NativeState.PAUSED) { if (mNextNativeState == NativeState.PAUSED) {
nativePause(); if (mSDLThread != null) {
if (mSurface != null) nativePause();
}
if (mSurface != null) {
mSurface.handlePause(); mSurface.handlePause();
}
mCurrentNativeState = mNextNativeState; mCurrentNativeState = mNextNativeState;
return; return;
} }