From 9500dc3a19466dae5269bf337364396b0a48309c Mon Sep 17 00:00:00 2001 From: Jorge Ruesga Date: Fri, 7 Nov 2014 01:25:20 +0100 Subject: photophase: restart lwp service on bad egl context This patch contains some fixes for bad egl context detection and other NPE and lint fixes Change-Id: I47c4348770dc72f768df4bea27c7817d1ec10c42 Signed-off-by: Jorge Ruesga --- .../wallpapers/photophase/PhotoPhaseRenderer.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseRenderer.java') diff --git a/src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseRenderer.java b/src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseRenderer.java index bb9ed29..9358877 100644 --- a/src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseRenderer.java +++ b/src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseRenderer.java @@ -181,6 +181,14 @@ public class PhotoPhaseRenderer implements GLSurfaceView.Renderer { } }; + private final Runnable mEGLContextWatchDog = new Runnable() { + @Override + public void run() { + // Restart the wallpaper + AndroidHelper.restartWallpaper(mContext); + } + }; + /** * Constructor of PhotoPhaseRenderer * @@ -314,6 +322,11 @@ public class PhotoPhaseRenderer implements GLSurfaceView.Renderer { } else { mDispatcher.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY); } + + // Set a watchdog to detect EGL bad context and restart the wallpaper + if (!mIsPreview) { + mHandler.postDelayed(mEGLContextWatchDog, 1000L); + } } /** @@ -709,6 +722,11 @@ public class PhotoPhaseRenderer implements GLSurfaceView.Renderer { */ @Override public void onDrawFrame(GL10 glUnused) { + // Remove the EGL context watchdog + if (!mIsPreview) { + mHandler.removeCallbacks(mEGLContextWatchDog); + } + // Set the projection, view and model GLES20.glViewport(0, -mStatusBarHeight, mWidth, mHeight); Matrix.setLookAtM(mVMatrix, 0, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); -- cgit v1.2.3 From 535d7bf7dbd1921229720834503f2ddf9c7882ac Mon Sep 17 00:00:00 2001 From: Jorge Ruesga Date: Sun, 9 Nov 2014 01:20:16 +0100 Subject: photophase: make lwp to survive a reboot The latest egl watchdog kill the app before they started. Increase the timeout to make the wallpaper to survive a device reboot Change-Id: I59a746fb9d599e0d016e4fc87c79d2a7d03a53d8 Signed-off-by: Jorge Ruesga --- src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseRenderer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseRenderer.java') diff --git a/src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseRenderer.java b/src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseRenderer.java index 9358877..e189e87 100644 --- a/src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseRenderer.java +++ b/src/org/cyanogenmod/wallpapers/photophase/PhotoPhaseRenderer.java @@ -325,7 +325,7 @@ public class PhotoPhaseRenderer implements GLSurfaceView.Renderer { // Set a watchdog to detect EGL bad context and restart the wallpaper if (!mIsPreview) { - mHandler.postDelayed(mEGLContextWatchDog, 1000L); + mHandler.postDelayed(mEGLContextWatchDog, 15000L); } } -- cgit v1.2.3