fix lost old callback when continuous call requestRenderAndNotify

This commit is contained in:
Alexander Hartmann 2024-06-24 20:47:39 +02:00 committed by Relintai
parent 7255741258
commit 2f27d74f3f

View File

@ -784,7 +784,7 @@ public class PandemoniumGLSurfaceView extends SurfaceView implements SurfaceHold
*/
public interface EGLConfigChooser {
/**
* Choose a configuration from the list. Implementors typically
* Choose a configuration from the list. Implementers typically
* implement this method by calling
* {@link EGL10#eglChooseConfig} and iterating through the results. Please consult the
* EGL specification available from The Khronos Group to learn how to call eglChooseConfig.
@ -1576,7 +1576,24 @@ public class PandemoniumGLSurfaceView extends SurfaceView implements SurfaceHold
mWantRenderNotification = true;
mRequestRender = true;
mRenderComplete = false;
mFinishDrawingRunnable = finishDrawing;
// fix lost old callback when continuous call requestRenderAndNotify
//
// If continuous call requestRenderAndNotify before trigger old
// callback, old callback will lose, cause VRI will wait for SV's
// draw to finish forever not calling finishDraw.
// https://android.googlesource.com/platform/frameworks/base/+/044fce0b826f2da3a192aac56785b5089143e693%5E%21/
//+++++++++++++++++++++++++++++++++++++++++++++++++++
final Runnable oldCallback = mFinishDrawingRunnable;
mFinishDrawingRunnable = () -> {
if (oldCallback != null) {
oldCallback.run();
}
if (finishDrawing != null) {
finishDrawing.run();
}
};
//----------------------------------------------------
sGLThreadManager.notifyAll();
}