Don't reallocate EGLSurface for same debug surface.

Recreating an EGLSurface for a surface that already has an
EGLSurface is not allowed according to the
[documentation](https://www.khronos.org/registry/EGL/sdk/docs/man/html/eglCreatePlatformWindowSurface.xhtml).

This fix was tested on the devices listed in the bug
description (Pixel 5a, Nexus 5).

PiperOrigin-RevId: 450473569
This commit is contained in:
hschlueter 2022-05-23 18:37:04 +01:00 committed by Ian Baker
parent 26a1817ebf
commit 196a99aa5f

View File

@ -602,10 +602,13 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
@Override
public synchronized void surfaceChanged(
SurfaceHolder holder, int format, int width, int height) {
surface = holder.getSurface();
eglSurface = null;
this.width = width;
this.height = height;
Surface newSurface = holder.getSurface();
if (surface == null || !surface.equals(newSurface)) {
surface = newSurface;
eglSurface = null;
}
}
@Override