mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
SizeManager: Don't send notifySurface if paused. Cleaner exits / task switches in the log.
This commit is contained in:
parent
1b8b441cfd
commit
8b9836afd3
2 changed files with 21 additions and 7 deletions
|
@ -677,6 +677,12 @@ public abstract class NativeActivity extends Activity {
|
|||
|
||||
public void notifySurface(Surface surface) {
|
||||
mSurface = surface;
|
||||
|
||||
if (!initialized) {
|
||||
Log.e(TAG, "Can't deal with surfaces while not initialized");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!javaGL) {
|
||||
// If we got a surface, this starts the thread. If not, it doesn't.
|
||||
if (mSurface == null) {
|
||||
|
@ -740,12 +746,6 @@ public abstract class NativeActivity extends Activity {
|
|||
navigationCallbackView = decorView;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
Log.i(TAG, "onStop - do nothing special");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
@ -803,6 +803,7 @@ public abstract class NativeActivity extends Activity {
|
|||
super.onPause();
|
||||
Log.i(TAG, "onPause");
|
||||
loseAudioFocus(this.audioManager, this.audioFocusChangeListener);
|
||||
sizeManager.setPaused(true);
|
||||
NativeApp.pause();
|
||||
if (!javaGL) {
|
||||
mSurfaceView.onPause();
|
||||
|
@ -838,6 +839,7 @@ public abstract class NativeActivity extends Activity {
|
|||
protected void onResume() {
|
||||
super.onResume();
|
||||
updateSustainedPerformanceMode();
|
||||
sizeManager.setPaused(false);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
updateSystemUiVisibility();
|
||||
}
|
||||
|
|
|
@ -39,10 +39,18 @@ public class SizeManager implements SurfaceHolder.Callback {
|
|||
private Point desiredSize = new Point();
|
||||
private int badOrientationCount = 0;
|
||||
|
||||
|
||||
private boolean paused = false;
|
||||
|
||||
public SizeManager(final NativeActivity a) {
|
||||
activity = a;
|
||||
}
|
||||
|
||||
|
||||
public void setPaused(boolean p) {
|
||||
paused = p;
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.P)
|
||||
public void setSurfaceView(SurfaceView view) {
|
||||
surfaceView = view;
|
||||
|
@ -107,7 +115,11 @@ public class SizeManager implements SurfaceHolder.Callback {
|
|||
NativeApp.backbufferResize(width, height, format);
|
||||
updateDisplayMeasurements();
|
||||
|
||||
activity.notifySurface(holder.getSurface());
|
||||
if (!paused) {
|
||||
activity.notifySurface(holder.getSurface());
|
||||
} else {
|
||||
Log.i(TAG, "Skipping notifySurface while paused");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue