DO NOT MERGE Prevent ImageWallpaper from keeping crashing am: a3bff94e18

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11700786

Change-Id: I112e4cbab9cc6c8da12a65c3691aa1dc92bb60d4
This commit is contained in:
Ahan Wu
2020-06-03 18:22:17 +00:00
committed by Automerger Merge Worker

View File

@@ -603,7 +603,16 @@ public class ImageWallpaper extends WallpaperService {
final FloatBuffer triangleVertices = createMesh(left, top, right, bottom); final FloatBuffer triangleVertices = createMesh(left, top, right, bottom);
final int texture = loadTexture(mBackground); int texture = 0;
try {
texture = loadTexture(mBackground);
} catch (IllegalArgumentException e) {
mEgl.eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
mEgl.eglDestroySurface(mEglDisplay, mEglSurface);
mEgl.eglDestroyContext(mEglDisplay, mEglContext);
mEgl.eglTerminate(mEglDisplay);
return false;
}
final int program = buildProgram(sSimpleVS, sSimpleFS); final int program = buildProgram(sSimpleVS, sSimpleFS);
final int attribPosition = glGetAttribLocation(program, "position"); final int attribPosition = glGetAttribLocation(program, "position");