Search code examples
androidsurfaceflinger

android 4.4, service 'SurfaceFlinger' died


I am running a native process that is capturing the screen in a loop using ScreenshotClient. randomly after several runs when I close the process I get "service 'SurfaceFlinger' died" and the screen restarts. This does not happen in android 4.2.

this is the backtrace:

I/DEBUG   (  111): backtrace:
I/DEBUG   (  111):     #00  pc 0002a61e  /system/lib/libgui.so
I/DEBUG   (  111):     #01  pc 0002f205  /system/lib/libgui.so (android::Surface::queueBuffer(ANativeWindowBuffer*, int)+220)
I/DEBUG   (  111):     #02  pc 0002e2cd  /system/lib/libgui.so (android::Surface::hook_queueBuffer(ANativeWindow*, ANativeWindowBuffer*, int)+10)
I/DEBUG   (  111):     #03  pc 00017fb9  /system/lib/libsurfaceflinger.so
I/DEBUG   (  111):     #04  pc 0001b6f1  /system/lib/libsurfaceflinger.so
I/DEBUG   (  111):     #05  pc 00015e6f  /system/lib/libsurfaceflinger.so
I/DEBUG   (  111):     #06  pc 00010767  /system/lib/libutils.so (android::Looper::pollInner(int)+394)
I/DEBUG   (  111):     #07  pc 00010869  /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+92)
I/DEBUG   (  111):     #08  pc 00016089  /system/lib/libsurfaceflinger.so
I/DEBUG   (  111):     #09  pc 00016f7b  /system/lib/libsurfaceflinger.so (android::SurfaceFlinger::run()+6)
I/DEBUG   (  111):     #10  pc 000008fd  /system/bin/surfaceflinger
I/DEBUG   (  111):     #11  pc 0000e403  /system/lib/libc.so (__libc_init+50)
I/DEBUG   (  111):     #12  pc 000007dc  /system/bin/surfaceflinger

Solution

  • when I cleanly close the process instead of killing it, SurfaceFlinger doesn't die anymore.