frameworks/base
修订版 | 71be05dc5d419aacd0d42484f7b6d2f44907e818 (tree) |
---|---|
时间 | 2020-06-05 03:25:48 |
作者 | Ahan Wu <ahanwu@goog...> |
Commiter | Anis Assi |
DO NOT MERGE Prevent ImageWallpaper from keeping crashing
GLUtil.texImage2D may throw exception that indicates bad image format.
We should catch this exception, otherwise, systemui may keep crashing.
Bug: 156087409
Test: Set a 16-bit rgb image as wallpaper
Test: Systemui shouldn't keep crashing
Change-Id: I6c9715c049b7848ecd5559ab76612a98dcd4ee6f
(cherry picked from commit a3bff94e184590351fd95f630e8b8313d1d2053b)
@@ -603,7 +603,16 @@ public class ImageWallpaper extends WallpaperService { | ||
603 | 603 | |
604 | 604 | final FloatBuffer triangleVertices = createMesh(left, top, right, bottom); |
605 | 605 | |
606 | - final int texture = loadTexture(mBackground); | |
606 | + int texture = 0; | |
607 | + try { | |
608 | + texture = loadTexture(mBackground); | |
609 | + } catch (IllegalArgumentException e) { | |
610 | + mEgl.eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); | |
611 | + mEgl.eglDestroySurface(mEglDisplay, mEglSurface); | |
612 | + mEgl.eglDestroyContext(mEglDisplay, mEglContext); | |
613 | + mEgl.eglTerminate(mEglDisplay); | |
614 | + return false; | |
615 | + } | |
607 | 616 | final int program = buildProgram(sSimpleVS, sSimpleFS); |
608 | 617 | |
609 | 618 | final int attribPosition = glGetAttribLocation(program, "position"); |