summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2011-08-25 17:01:24 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-08-25 17:01:24 -0700
commit359ef7985316397564a6a999d77f6cc1edab7373 (patch)
tree183dc9f9767340fa93be0efb08dd6d2faf230be7 /packages/SystemUI/src/com
parentbf446c2a2b9c2e0c3808b35c14955319a7adfae5 (diff)
parentf929629e74fe84b986f76db448b9c95d72b2903e (diff)
downloadframeworks_base-359ef7985316397564a6a999d77f6cc1edab7373.zip
frameworks_base-359ef7985316397564a6a999d77f6cc1edab7373.tar.gz
frameworks_base-359ef7985316397564a6a999d77f6cc1edab7373.tar.bz2
Merge "Fix crash with OpenGL wallpaper Bug #5216751"
Diffstat (limited to 'packages/SystemUI/src/com')
-rw-r--r--packages/SystemUI/src/com/android/systemui/ImageWallpaper.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
index 049a284..492f3c2 100644
--- a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
+++ b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
@@ -300,7 +300,9 @@ public class ImageWallpaper extends WallpaperService {
}
if (mIsHwAccelerated) {
- drawWallpaperWithOpenGL(sh, availw, availh, xPixels, yPixels);
+ if (!drawWallpaperWithOpenGL(sh, availw, availh, xPixels, yPixels)) {
+ drawWallpaperWithCanvas(sh, availw, availh, xPixels, yPixels);
+ }
} else {
drawWallpaperWithCanvas(sh, availw, availh, xPixels, yPixels);
}
@@ -367,8 +369,8 @@ public class ImageWallpaper extends WallpaperService {
}
}
- private void drawWallpaperWithOpenGL(SurfaceHolder sh, int w, int h, int left, int top) {
- initGL(sh);
+ private boolean drawWallpaperWithOpenGL(SurfaceHolder sh, int w, int h, int left, int top) {
+ if (!initGL(sh)) return false;
final float right = left + mBackgroundWidth;
final float bottom = top + mBackgroundHeight;
@@ -423,6 +425,8 @@ public class ImageWallpaper extends WallpaperService {
checkEglError();
finishGL();
+
+ return true;
}
private FloatBuffer createMesh(int left, int top, float right, float bottom) {
@@ -533,11 +537,12 @@ public class ImageWallpaper extends WallpaperService {
}
private void finishGL() {
- mEgl.eglDestroyContext(mEglDisplay, mEglContext);
+ mEgl.eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
mEgl.eglDestroySurface(mEglDisplay, mEglSurface);
+ mEgl.eglDestroyContext(mEglDisplay, mEglContext);
}
- private void initGL(SurfaceHolder surfaceHolder) {
+ private boolean initGL(SurfaceHolder surfaceHolder) {
mEgl = (EGL10) EGLContext.getEGL();
mEglDisplay = mEgl.eglGetDisplay(EGL_DEFAULT_DISPLAY);
@@ -565,7 +570,7 @@ public class ImageWallpaper extends WallpaperService {
int error = mEgl.eglGetError();
if (error == EGL_BAD_NATIVE_WINDOW) {
Log.e(GL_LOG_TAG, "createWindowSurface returned EGL_BAD_NATIVE_WINDOW.");
- return;
+ return false;
}
throw new RuntimeException("createWindowSurface failed " +
GLUtils.getEGLErrorString(error));
@@ -577,6 +582,8 @@ public class ImageWallpaper extends WallpaperService {
}
mGL = mEglContext.getGL();
+
+ return true;
}