diff --git a/platform/android/java/lib/src/org/pandemoniumengine/pandemonium/gl/PandemoniumGLSurfaceView.java b/platform/android/java/lib/src/org/pandemoniumengine/pandemonium/gl/PandemoniumGLSurfaceView.java index aaed15710..14eddde9d 100644 --- a/platform/android/java/lib/src/org/pandemoniumengine/pandemonium/gl/PandemoniumGLSurfaceView.java +++ b/platform/android/java/lib/src/org/pandemoniumengine/pandemonium/gl/PandemoniumGLSurfaceView.java @@ -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(); }