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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
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 fc6c5ad..b47c267 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
@@ -98,7 +98,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
if (mMotionListener == null) {
if (Build.VERSION.SDK_INT >= 26) {
mMotionListener = new SDLGenericMotionListener_API26();
- } else
+ } else
if (Build.VERSION.SDK_INT >= 24) {
mMotionListener = new SDLGenericMotionListener_API24();
} else {
@@ -327,15 +327,15 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
case Surface.ROTATION_0:
result = SDL_ORIENTATION_PORTRAIT;
break;
-
+
case Surface.ROTATION_90:
result = SDL_ORIENTATION_LANDSCAPE;
break;
-
+
case Surface.ROTATION_180:
result = SDL_ORIENTATION_PORTRAIT_FLIPPED;
break;
-
+
case Surface.ROTATION_270:
result = SDL_ORIENTATION_LANDSCAPE_FLIPPED;
break;
@@ -390,9 +390,6 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
return;
}
- mNextNativeState = NativeState.PAUSED;
- SDLActivity.handleNativeState();
-
// Send a quit message to the application
SDLActivity.mExitCalledFromJava = true;
SDLActivity.nativeQuit();
@@ -483,9 +480,12 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
// Try a transition to paused state
if (mNextNativeState == NativeState.PAUSED) {
- nativePause();
- if (mSurface != null)
+ if (mSDLThread != null) {
+ nativePause();
+ }
+ if (mSurface != null) {
mSurface.handlePause();
+ }
mCurrentNativeState = mNextNativeState;
return;
}