Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANR after opengl context loss on Live Wallpaper Preview #5723

Open
ArdiDev opened this issue Jul 25, 2019 · 0 comments
Open

ANR after opengl context loss on Live Wallpaper Preview #5723

ArdiDev opened this issue Jul 25, 2019 · 0 comments
Labels

Comments

@ArdiDev
Copy link

ArdiDev commented Jul 25, 2019

Issue details

Hi,
I'm writing about an ANR that happens every time a user switches opengl context during a live wallpaper preview. This ANR is present on all Android 9.0+ devices and on very few 8.0 - 9.0 devices.

Reproduction steps/code

The reproduction is really easy given a live wallpaper developed with the libgdx framework and an Android 9.0+ device or an Android Studio emulator (9.0+):

  1. Install on an Android 9.0+ device a live wallpaper from the store that uses libgdx framework, for example, the well known Double Helix Live Wallpaper:
    https://play.google.com/store/apps/details?id=com.cyphercove.doublehelixfree
    or build your own through the various live wallpaper examples.
  2. Open the live wallpaper preview (it is the view where you can see the live wallpaper running but you still haven't set it as your live wallpaper)
  3. Press the home button to switch to the home screen.
  4. Press the recent apps button and resume the live wallpaper app.

At this moment the screen goes black and an ARN occurs with the message:
E/libEGL: eglCreateWindowSurface: native_window_api_connect (win=0x7e53b97010) failed (0xffffffed) (already connected to another API?)
E/libEGL: eglCreateWindowSurface:896 error 3003 (EGL_BAD_ALLOC)

After some searching, I found out that the ANR happens due to opengl context loss, not only for libgdx live wallpapers but for all live wallpapers that use opengl, (an Android bug probably) and the possible workaround is given here:
https://stackoverflow.com/questions/36312209/opengls-eglcreatewindowsurface-gl-error-egl-bad-alloc
But I have no idea how to implement it on libgdx.

As you can imagine, these ANRs are very frequent and I have something like 1500+ reports per day across my live wallpaper apps. If someone has any clue on how to proceed that would be awesome. Many thanks for all your efforts.

Version of LibGDX and/or relevant dependencies

All versions

Stacktrace

2019-07-25 16:23:49.191 12811-12811/com.mmm.mmm I/WallpaperService: engine paused
2019-07-25 16:23:49.191 12811-12811/com.mmm.mmm I/AndroidInput: sensor listener tear down
2019-07-25 16:23:49.212 12811-13241/com.mmm.mmm W/libEGL: EGLNativeWindowType 0x7e53b97010 disconnect failed
2019-07-25 16:23:49.212 12811-12811/com.mmm.mmm D/WallpaperService: reportVisibility onVisibilityChanged visible: false
2019-07-25 16:23:49.746 12811-12851/com.mmm.mmm D/WallpaperService: dispatchAppVisibility onVisibilityChanged(): false
2019-07-25 16:23:53.095 12811-12844/com.mmm.mmm D/WallpaperService: dispatchAppVisibility onVisibilityChanged(): true
2019-07-25 16:23:53.164 12811-12811/com.mmm.mmm D/WallpaperService: updateSurface forceRelayout=false forceReport=false redrawNeeded=false myWidth=1440 myHeight=2960 fixedSize=true x = 0 y = 0 mWidth=1440 mHeight=2960 mIsSleepMode=false
2019-07-25 16:23:53.164 12811-12811/com.mmm.mmm I/WallpaperService: engine resumed
2019-07-25 16:23:53.164 12811-12811/com.mmm.mmm I/AndroidInput: sensor listener setup
2019-07-25 16:23:53.165 12811-13241/com.mmm.mmm E/libEGL: eglCreateWindowSurface: native_window_api_connect (win=0x7e53b97010) failed (0xffffffed) (already connected to another API?)
2019-07-25 16:23:53.165 12811-13241/com.mmm.mmm E/libEGL: eglCreateWindowSurface:896 error 3003 (EGL_BAD_ALLOC)

Please select the affected platforms

  • [ X ] Android
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants