-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android: Minor activity lifecycle stuff #18230
Changes from 5 commits
2291855
2b0bbb1
0013c6f
1b8b441
8b9836a
0fd22ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 void surfaceChanged(SurfaceHolder holder, int format, int width, int heig | |
NativeApp.backbufferResize(width, height, format); | ||
updateDisplayMeasurements(); | ||
|
||
activity.notifySurface(holder.getSurface()); | ||
if (!paused) { | ||
activity.notifySurface(holder.getSurface()); | ||
} else { | ||
Log.i(TAG, "Skipping notifySurface while paused"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can't cause it to have an outdated surface, can it? -[Unknown] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does appear to be OK because we always get a surface notification after the next resume, which is when we want it. I believe spurious surfaceChanged events after pause are a bug that seems to have been fixed around Android 12. |
||
} | ||
} | ||
|
||
@Override | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would think so. I think it should be on shutdown too. It should not be possible to update
renderer_inited
to true, updaterenderer_inited
to false, or render at the same time. Those operations should all be sequenced. Remember that there are annoying things happening with resize events and etc.-[Unknown]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, true. I'll throw in a lock in shutdown too.