I'm in disbelief, but it works! Why does that hack work? Is it a previous call to eglCreateWindowSurface which returns a bad value and after that, cleaning up causes a bad state and the next call to create window surface freezes? I don't quite understand but I guess I never checked the return value of that call (because it wasn't returning when I was having problems, but maybe it was too late then :)).
I tested and tested and tested again and this held up against all the orientation changes I could possibly make. Good work! I'll update the code I posted. BTW - I'm still seeing the occasional: E/libEGL ( 5769): eglChooseConfig:897 error 3005 (EGL_BAD_CONFIG) W/dalvikvm( 5769): threadid=13: thread exiting with uncaught exception (group=0x4001b180) E/AndroidRuntime( 5769): Uncaught handler: thread GLThread 7 exiting due to uncaught exception E/AndroidRuntime( 5769): java.lang.IllegalArgumentException E/AndroidRuntime( 5769): at com.google.android.gles_jni.EGLImpl.eglGetConfigAttrib(Native Method) E/AndroidRuntime( 5769): at android.opengl.EglHelper $ComponentSizeChooser.findConfigAttrib(EglHelper.java:1007) E/AndroidRuntime( 5769): at android.opengl.EglHelper $ComponentSizeChooser.chooseConfig(EglHelper.java:987) E/AndroidRuntime( 5769): at android.opengl.EglHelper $BaseConfigChooser.chooseConfig(EglHelper.java:951) E/AndroidRuntime( 5769): at android.opengl.EglHelper.start(EglHelper.java:127) E/AndroidRuntime( 5769): at android.opengl.EglHelper $GLThread.guardedRun(EglHelper.java:421) E/AndroidRuntime( 5769): at android.opengl.EglHelper $GLThread.run(EglHelper.java:358) I'm trying to track that one down but it's very hard to recreate. It likes to happen the first time you run a newly installed gl live wallpaper but then it doesn't happen again for a while. Thanks guys for all your help! On Apr 6, 11:29 am, shaun <[email protected]> wrote: > Assuming I correctly identified the code that unixseb uses as the > workaround/fix for orientation changes on Droid in Live Wallpaper with > OpenGL, the following code is the same with the exception of > recursion: > > public EGLSurface createWindowSurface(EGL10 egl, EGLDisplay > display, EGLConfig config, Object nativeWindow) { > EGLSurface eglSurface = null; > while (eglSurface == null) { > try { > eglSurface = egl.eglCreateWindowSurface(display, > config, nativeWindow, null); > } catch (Throwable t) { > } finally { > if (eglSurface == null) { > try { > Thread.sleep(10); > } catch (InterruptedException t) { > } > } > } > > } > return eglSurface; > } > > I'd like to know if unixseb's fix works for others. I still cannot > test. > > On Apr 6, 11:00 am, Ralf Schneider <[email protected]> wrote: > > > > > I'm also interested in this topic. I got an 404 on the link: This seems to > > work: > > >http://code.google.com/p/earth-live-wallpaper/ > > > Thank you for sharing your code! > > > 2010/4/6 unixseb <[email protected]> > > > > have a look at the svn repository on code.google.com/project/earth- > > > live-wallpaper <http://code.google.com/project/earth-%0Alive-wallpaper> > > > the hack int the glwallpaperservice class avoid some crashes with > > > screen rotation on droids. > > > > On 5 avr, 20:24, Robert Green <[email protected]> wrote: > > > > Oh, so you solved it?? What's the issue and what's the workaround? > > > > > On Apr 4, 3:33 pm, unixseb <[email protected]> wrote: > > > > > > i can help you, > > > > > i'm having this issue with earth live wallpaper. > > > > > i tracked a bug in the swap function taht causes service dies, but i > > > > > was looking for this one for a long time now ! > > > > > > On 3 avr, 23:56, Robert Green <[email protected]> wrote: > > > > > > > I've had this reported to me by a few people using the > > > > > >GLWallpaperServicecode I posted. I've been debugging this for hours > > > > > > and have so far tracked the problem down to > > > > > > egl.eglCreateWindowSurface(display, config, nativeWindow, null); > > > > > > > It never returns and every notifyAll() after that results in: > > > > > > W/SharedBufferStack( 1030): waitForCondition(ReallocateCondition) > > > > > > timed out (identity=288, status=0). CPU may be pegged. trying again. > > > > > > > It seems to happen when switching orientation - so when the surface > > > is > > > > > > being destroyed/recreated and more specifically when calls to render > > > > > > the frame are being made at the same time. If there are no render > > > > > > calls happening while switching, things seem mostly ok. I'm > > > debugging > > > > > > this further but I feel like a method like that should never > > > > > > deadlock. Seems like a bug somewhere below the line to me. > > > > > > > Since none of the GL init code from the shipped live wallpapers was > > > > > > posted anywhere, I have no good reference to use for how to properly > > > > > > handle the window resizing. Clearly the code I'm using does it a > > > > > > little differently but I still feel like a deadlock like this should > > > > > > not occur. > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Android Developers" group. > > > To post to this group, send email to [email protected] > > > To unsubscribe from this group, send email to > > > [email protected]<android-developers%2Bunsubs > > > [email protected]> > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en > > > > To unsubscribe, reply using "remove me" as the subject.- Hide quoted text > > > - > > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

